s3: VFS: Change SMB_VFS_GET_QUOTA to use const struct smb_filename * instead of const...
authorJeremy Allison <jra@samba.org>
Thu, 1 Jun 2017 18:45:25 +0000 (11:45 -0700)
committerJeremy Allison <jra@samba.org>
Sun, 18 Jun 2017 00:49:25 +0000 (02:49 +0200)
We need to migrate all pathname based VFS calls to use a struct
to finish modernising the VFS with extra timestamp and flags parameters.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
18 files changed:
examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/include/vfs_macros.h
source3/modules/vfs_cap.c
source3/modules/vfs_ceph.c
source3/modules/vfs_default.c
source3/modules/vfs_default_quota.c
source3/modules/vfs_fake_dfq.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_gpfs.c
source3/modules/vfs_shadow_copy2.c
source3/modules/vfs_snapper.c
source3/modules/vfs_time_audit.c
source3/smbd/ntquotas.c
source3/smbd/quotas.c
source3/smbd/vfs.c

index 40951db35e31db688fef6420b96d82d50548eb7b..7dd258f15287cde108ef2623d07dd950b8073837 100644 (file)
@@ -56,9 +56,11 @@ static uint64_t skel_disk_free(vfs_handle_struct *handle,
        return 0;
 }
 
-static int skel_get_quota(vfs_handle_struct *handle, const char *path,
-                         enum SMB_QUOTA_TYPE qtype, unid_t id,
-                         SMB_DISK_QUOTA *dq)
+static int skel_get_quota(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *dq)
 {
        errno = ENOSYS;
        return -1;
index 83c0c2ae4d97a86ad6e02b7ed27bc0225d99a42b..5e66be49d425daac2880ce9ec0f15adf31a92f5a 100644 (file)
@@ -57,11 +57,13 @@ static uint64_t skel_disk_free(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree, dsize);
 }
 
-static int skel_get_quota(vfs_handle_struct *handle, const char *path,
-                         enum SMB_QUOTA_TYPE qtype, unid_t id,
-                         SMB_DISK_QUOTA *dq)
+static int skel_get_quota(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *dq)
 {
-       return SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, dq);
+       return SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, dq);
 }
 
 static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
index 4a7179a094b886e5328bbaa498aa78746c88987a..a0eca7730f93e9710e607d3c21b17308e32303d9 100644 (file)
                to const struct smb_filename * */
 /* Version 37 - Change disk_free from const char *
                to const struct smb_filename * */
+/* Version 37 - Change get_quota from const char *
+               to const struct smb_filename * */
 
 #define SMB_VFS_INTERFACE_VERSION 37
 
@@ -607,9 +609,11 @@ struct vfs_fn_pointers {
                                uint64_t *bsize,
                                uint64_t *dfree,
                                uint64_t *dsize);
-       int (*get_quota_fn)(struct vfs_handle_struct *handle, const char *path,
-                           enum SMB_QUOTA_TYPE qtype, unid_t id,
-                           SMB_DISK_QUOTA *qt);
+       int (*get_quota_fn)(struct vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *qt);
        int (*set_quota_fn)(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt);
        int (*get_shadow_copy_data_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp, struct shadow_copy_data *shadow_copy_data, bool labels);
        int (*statvfs_fn)(struct vfs_handle_struct *handle, const char *path, struct vfs_statvfs_struct *statbuf);
@@ -1065,9 +1069,11 @@ uint64_t smb_vfs_call_disk_free(struct vfs_handle_struct *handle,
                                uint64_t *bsize,
                                uint64_t *dfree,
                                uint64_t *dsize);
-int smb_vfs_call_get_quota(struct vfs_handle_struct *handle, const char *path,
-                          enum SMB_QUOTA_TYPE qtype, unid_t id,
-                          SMB_DISK_QUOTA *qt);
+int smb_vfs_call_get_quota(struct vfs_handle_struct *handle,
+                               const struct smb_filename *smb_filename,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *qt);
 int smb_vfs_call_set_quota(struct vfs_handle_struct *handle,
                           enum SMB_QUOTA_TYPE qtype, unid_t id,
                           SMB_DISK_QUOTA *qt);
index cd34ec981c1dcc2bf0949822d2b72d19a439a118..d49d340b002f95f734bc4d87ffa1965d08f9e89c 100644 (file)
 #define SMB_VFS_NEXT_DISK_FREE(handle, smb_fname, bsize, dfree ,dsize)\
        smb_vfs_call_disk_free((handle)->next, (smb_fname), (bsize), (dfree), (dsize))
 
-#define SMB_VFS_GET_QUOTA(conn, path, qtype, id, qt)                           \
-       smb_vfs_call_get_quota((conn)->vfs_handles, (path), (qtype), (id), (qt))
-#define SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt)                    \
-       smb_vfs_call_get_quota((handle)->next, (path), (qtype), (id), (qt))
+#define SMB_VFS_GET_QUOTA(conn, smb_fname, qtype, id, qt)                           \
+       smb_vfs_call_get_quota((conn)->vfs_handles, (smb_fname), (qtype), (id), (qt))
+#define SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, qt)                    \
+       smb_vfs_call_get_quota((handle)->next, (smb_fname), (qtype), (id), (qt))
 
 #define SMB_VFS_SET_QUOTA(conn, qtype, id, qt) \
        smb_vfs_call_set_quota((conn)->vfs_handles, (qtype), (id), (qt))
index cf3bb94498c977d81206a7dabdcc58b83f162998..cfb02cbdf62dfe74ba781abe2b5614414d3f364e 100644 (file)
@@ -56,17 +56,30 @@ static uint64_t cap_disk_free(vfs_handle_struct *handle,
                        bsize, dfree, dsize);
 }
 
-static int cap_get_quota(vfs_handle_struct *handle, const char *path,
-                        enum SMB_QUOTA_TYPE qtype, unid_t id,
-                        SMB_DISK_QUOTA *dq)
+static int cap_get_quota(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       enum SMB_QUOTA_TYPE qtype,
+                       unid_t id,
+                       SMB_DISK_QUOTA *dq)
 {
-       char *cappath = capencode(talloc_tos(), path);
+       char *cappath = capencode(talloc_tos(), smb_fname->base_name);
+       struct smb_filename *cap_smb_fname = NULL;
 
        if (!cappath) {
                errno = ENOMEM;
                return -1;
        }
-       return SMB_VFS_NEXT_GET_QUOTA(handle, cappath, qtype, id, dq);
+       cap_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       cappath,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+       if (cap_smb_fname == NULL) {
+               TALLOC_FREE(cappath);
+               errno = ENOMEM;
+               return -1;
+       }
+       return SMB_VFS_NEXT_GET_QUOTA(handle, cap_smb_fname, qtype, id, dq);
 }
 
 static DIR *cap_opendir(vfs_handle_struct *handle,
index 1244468abed02ffcc2c7526d492b3e9f2b702b38..5f7440473dff29c7be3d3cb43a28eca15ccb7dc8 100644 (file)
@@ -201,8 +201,10 @@ static uint64_t cephwrap_disk_free(struct vfs_handle_struct *handle,
 }
 
 static int cephwrap_get_quota(struct vfs_handle_struct *handle,
-                             const char *path, enum SMB_QUOTA_TYPE qtype,
-                             unid_t id, SMB_DISK_QUOTA *qt)
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *qt)
 {
        /* libceph: Ceph does not implement this */
 #if 0
index 1c267287cff480fac7e4392ee73a48baaa8c6017..664da956c7c66d24669135fdc3e588e1b458b44d 100644 (file)
@@ -69,15 +69,17 @@ static uint64_t vfswrap_disk_free(vfs_handle_struct *handle,
        return *dfree / 2;
 }
 
-static int vfswrap_get_quota(struct vfs_handle_struct *handle, const char *path,
-                            enum SMB_QUOTA_TYPE qtype, unid_t id,
-                            SMB_DISK_QUOTA *qt)
+static int vfswrap_get_quota(struct vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *qt)
 {
 #ifdef HAVE_SYS_QUOTAS
        int result;
 
        START_PROFILE(syscall_get_quota);
-       result = sys_get_quota(path, qtype, id, qt);
+       result = sys_get_quota(smb_fname->base_name, qtype, id, qt);
        END_PROFILE(syscall_get_quota);
        return result;
 #else
index 6f1d2a7f619b87c316ae4d34b7506c82018c35d1..c27681af00f5af36d1a4272e19a6adf40d508bb9 100644 (file)
 #define DEFAULT_QUOTA_GID_NOLIMIT(handle) \
        lp_parm_bool(SNUM((handle)->conn),DEFAULT_QUOTA_NAME,"gid nolimit",DEFAULT_QUOTA_GID_NOLIMIT_DEFAULT)
 
-static int default_quota_get_quota(vfs_handle_struct *handle, const char *path,
-                                  enum SMB_QUOTA_TYPE qtype, unid_t id,
-                                  SMB_DISK_QUOTA *dq)
+static int default_quota_get_quota(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *dq)
 {
        int ret = -1;
 
-       if ((ret = SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, dq)) != 0) {
+       if ((ret = SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname,
+                               qtype, id, dq)) != 0) {
                return ret;
        }
 
@@ -124,8 +127,8 @@ static int default_quota_get_quota(vfs_handle_struct *handle, const char *path,
                                unid_t qid;
                                uint32_t qflags = dq->qflags;
                                qid.uid = DEFAULT_QUOTA_UID(handle);
-                               SMB_VFS_NEXT_GET_QUOTA(
-                                   handle, path, SMB_USER_QUOTA_TYPE, qid, dq);
+                               SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname,
+                                       SMB_USER_QUOTA_TYPE, qid, dq);
                                dq->qflags = qflags;
                        }
                        break;
@@ -135,7 +138,7 @@ static int default_quota_get_quota(vfs_handle_struct *handle, const char *path,
                                unid_t qid;
                                uint32_t qflags = dq->qflags;
                                qid.gid = DEFAULT_QUOTA_GID(handle);
-                               SMB_VFS_NEXT_GET_QUOTA(handle, path,
+                               SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname,
                                                       SMB_GROUP_QUOTA_TYPE,
                                                       qid, dq);
                                dq->qflags = qflags;
index 5e8879fe1cc12224ec972ada81d74ce84ea514c1..971db68bc557d212cd64e5c9df329e791881d85a 100644 (file)
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_VFS
 
-static int dfq_get_quota(struct vfs_handle_struct *handle, const char *path,
-                        enum SMB_QUOTA_TYPE qtype, unid_t id,
-                        SMB_DISK_QUOTA *qt);
+static int dfq_get_quota(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       enum SMB_QUOTA_TYPE qtype,
+                       unid_t id,
+                       SMB_DISK_QUOTA *qt);
 
 static uint64_t dfq_load_param(int snum, const char *path, const char *section,
                               const char *param, uint64_t def_val)
@@ -88,9 +90,11 @@ static uint64_t dfq_disk_free(vfs_handle_struct *handle,
        return free_1k;
 }
 
-static int dfq_get_quota(struct vfs_handle_struct *handle, const char *path,
-                        enum SMB_QUOTA_TYPE qtype, unid_t id,
-                        SMB_DISK_QUOTA *qt)
+static int dfq_get_quota(struct vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       enum SMB_QUOTA_TYPE qtype,
+                       unid_t id,
+                       SMB_DISK_QUOTA *qt)
 {
        int rc = 0;
        int save_errno;
@@ -99,7 +103,7 @@ static int dfq_get_quota(struct vfs_handle_struct *handle, const char *path,
        uint64_t bsize = 0;
        char *rpath = NULL;
 
-       rpath = SMB_VFS_NEXT_REALPATH(handle, path);
+       rpath = SMB_VFS_NEXT_REALPATH(handle, smb_fname->base_name);
        if (rpath == NULL) {
                goto dflt;
        }
@@ -160,7 +164,7 @@ static int dfq_get_quota(struct vfs_handle_struct *handle, const char *path,
        goto out;
 
 dflt:
-       rc = SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt);
+       rc = SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, qt);
 
 out:
        save_errno = errno;
index 916825767bfd209c2d7e46f4b0f939077448cc0f..01cea1aaee495a1a8efb85e4591a304969a8467a 100644 (file)
@@ -693,14 +693,17 @@ static uint64_t smb_full_audit_disk_free(vfs_handle_struct *handle,
 }
 
 static int smb_full_audit_get_quota(struct vfs_handle_struct *handle,
-                                   const char *path, enum SMB_QUOTA_TYPE qtype,
-                                   unid_t id, SMB_DISK_QUOTA *qt)
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *qt)
 {
        int result;
 
-       result = SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt);
+       result = SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, qt);
 
-       do_log(SMB_VFS_OP_GET_QUOTA, (result >= 0), handle, "%s", path);
+       do_log(SMB_VFS_OP_GET_QUOTA, (result >= 0), handle, "%s",
+                       smb_fname->base_name);
 
        return result;
 }
index cabb86120d9688d5e337b54e13e6d6e5f4c1d894..3d28381eaf4b1599eda6c92642ea79471cd8c1ea 100644 (file)
@@ -402,9 +402,10 @@ static uint64_t vfs_gluster_disk_free(struct vfs_handle_struct *handle,
 }
 
 static int vfs_gluster_get_quota(struct vfs_handle_struct *handle,
-                                const char *path,
-                                enum SMB_QUOTA_TYPE qtype, unid_t id,
-                                SMB_DISK_QUOTA *qt)
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *qt)
 {
        errno = ENOSYS;
        return -1;
index 9898d44391555a0cae976c13c956e1c6f6ba0362..a552cdda4d95809f41785b3eb18d9545b78a53e8 100644 (file)
@@ -2217,9 +2217,11 @@ static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle,
        return *dfree / 2;
 }
 
-static int vfs_gpfs_get_quota(vfs_handle_struct *handle, const char *path,
-                         enum SMB_QUOTA_TYPE qtype, unid_t id,
-                         SMB_DISK_QUOTA *dq)
+static int vfs_gpfs_get_quota(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *dq)
 {
        switch(qtype) {
                /*
@@ -2237,7 +2239,8 @@ static int vfs_gpfs_get_quota(vfs_handle_struct *handle, const char *path,
                        errno = ENOSYS;
                        return -1;
                default:
-                       return SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, dq);
+                       return SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname,
+                                       qtype, id, dq);
        }
 }
 
index e1f30398c1d777ce4124d08e2475021525ee3bdd..faacc4591463a04d0b0770fa5836e1ef2da8d610 100644 (file)
@@ -2792,22 +2792,28 @@ static uint64_t shadow_copy2_disk_free(vfs_handle_struct *handle,
        return ret;
 }
 
-static int shadow_copy2_get_quota(vfs_handle_struct *handle, const char *path,
-                                 enum SMB_QUOTA_TYPE qtype, unid_t id,
-                                 SMB_DISK_QUOTA *dq)
+static int shadow_copy2_get_quota(vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *dq)
 {
        time_t timestamp = 0;
        char *stripped = NULL;
        int ret;
        int saved_errno = 0;
        char *conv;
+       struct smb_filename *conv_smb_fname = NULL;
 
-       if (!shadow_copy2_strip_snapshot(talloc_tos(), handle, path, &timestamp,
-                                        &stripped)) {
+       if (!shadow_copy2_strip_snapshot(talloc_tos(),
+                               handle,
+                               smb_fname->base_name,
+                               &timestamp,
+                               &stripped)) {
                return -1;
        }
        if (timestamp == 0) {
-               return SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, dq);
+               return SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, dq);
        }
 
        conv = shadow_copy2_convert(talloc_tos(), handle, stripped, timestamp);
@@ -2815,13 +2821,22 @@ static int shadow_copy2_get_quota(vfs_handle_struct *handle, const char *path,
        if (conv == NULL) {
                return -1;
        }
-
-       ret = SMB_VFS_NEXT_GET_QUOTA(handle, conv, qtype, id, dq);
+       conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       conv,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
+       if (conv_smb_fname == NULL) {
+               TALLOC_FREE(conv);
+               return -1;
+       }
+       ret = SMB_VFS_NEXT_GET_QUOTA(handle, conv_smb_fname, qtype, id, dq);
 
        if (ret == -1) {
                saved_errno = errno;
        }
        TALLOC_FREE(conv);
+       TALLOC_FREE(conv_smb_fname);
        if (saved_errno != 0) {
                errno = saved_errno;
        }
index 774f7ee3c69e9e65516346e3294830e6436df21d..41800bf7a3aca1ecd66cb6a930046ce7d1a6de23 100644 (file)
@@ -3032,22 +3032,25 @@ static uint64_t snapper_gmt_disk_free(vfs_handle_struct *handle,
        return ret;
 }
 
-static int snapper_gmt_get_quota(vfs_handle_struct *handle, const char *path,
-                                enum SMB_QUOTA_TYPE qtype, unid_t id,
-                                SMB_DISK_QUOTA *dq)
+static int snapper_gmt_get_quota(vfs_handle_struct *handle,
+                       const struct smb_filename *smb_fname,
+                       enum SMB_QUOTA_TYPE qtype,
+                       unid_t id,
+                       SMB_DISK_QUOTA *dq)
 {
-       time_t timestamp;
-       char *stripped;
+       time_t timestamp = 0;
+       char *stripped = NULL;
        int ret;
-       int saved_errno;
-       char *conv;
+       int saved_errno = 0;
+       char *conv = NULL;
+       struct smb_filename *conv_smb_fname = NULL;
 
-       if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, path, &timestamp,
-                                       &stripped)) {
+       if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
+                               smb_fname->base_name, &timestamp, &stripped)) {
                return -1;
        }
        if (timestamp == 0) {
-               return SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, dq);
+               return SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, dq);
        }
 
        conv = snapper_gmt_convert(talloc_tos(), handle, stripped, timestamp);
@@ -3055,13 +3058,26 @@ static int snapper_gmt_get_quota(vfs_handle_struct *handle, const char *path,
        if (conv == NULL) {
                return -1;
        }
-
-       ret = SMB_VFS_NEXT_GET_QUOTA(handle, conv, qtype, id, dq);
-
-       saved_errno = errno;
+       conv_smb_fname = synthetic_smb_fname(talloc_tos(),
+                                       conv,
+                                       NULL,
+                                       NULL,
+                                       smb_fname->flags);
        TALLOC_FREE(conv);
-       errno = saved_errno;
+       if (conv_smb_fname == NULL) {
+               errno = ENOMEM;
+               return -1;
+       }
 
+       ret = SMB_VFS_NEXT_GET_QUOTA(handle, conv_smb_fname, qtype, id, dq);
+
+       if (ret == -1) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(conv_smb_fname);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
        return ret;
 }
 
index 092474fd0d8a607e9f3b80bd80b3533ede88d690..ebfcb8df655e4ec3fb5c4d7c6874e60c5651c06b 100644 (file)
@@ -182,20 +182,24 @@ static uint64_t smb_time_audit_disk_free(vfs_handle_struct *handle,
 }
 
 static int smb_time_audit_get_quota(struct vfs_handle_struct *handle,
-                                   const char *path, enum SMB_QUOTA_TYPE qtype,
-                                   unid_t id, SMB_DISK_QUOTA *qt)
+                                       const struct smb_filename *smb_fname,
+                                       enum SMB_QUOTA_TYPE qtype,
+                                       unid_t id,
+                                       SMB_DISK_QUOTA *qt)
 {
        int result;
        struct timespec ts1,ts2;
        double timediff;
 
        clock_gettime_mono(&ts1);
-       result = SMB_VFS_NEXT_GET_QUOTA(handle, path, qtype, id, qt);
+       result = SMB_VFS_NEXT_GET_QUOTA(handle, smb_fname, qtype, id, qt);
        clock_gettime_mono(&ts2);
        timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
 
        if (timediff > audit_timeout) {
-               smb_time_audit_log("get_quota", timediff);
+               smb_time_audit_log_fname("get_quota",
+                               timediff,
+                               smb_fname->base_name);
        }
        return result;
 }
index 8a44f7c674a4ef7b761a068ef2d1c4e8e859a05e..7e2c03636968246e8f767dbe28d7068f6c61bd65 100644 (file)
@@ -74,6 +74,8 @@ NTSTATUS vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype,
        int ret;
        SMB_DISK_QUOTA D;
        unid_t id;
+       struct smb_filename *smb_fname_cwd = NULL;
+       int saved_errno = 0;
 
        ZERO_STRUCT(D);
 
@@ -91,7 +93,23 @@ NTSTATUS vfs_get_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype,
                return NT_STATUS_NO_SUCH_USER;
        }
 
-       ret = SMB_VFS_GET_QUOTA(fsp->conn, ".", qtype, id, &D);
+       smb_fname_cwd = synthetic_smb_fname(talloc_tos(),
+                               ".",
+                               NULL,
+                               NULL,
+                               0);
+       if (smb_fname_cwd == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       ret = SMB_VFS_GET_QUOTA(fsp->conn, smb_fname_cwd, qtype, id, &D);
+       if (ret == -1) {
+               saved_errno = errno;
+       }
+       TALLOC_FREE(smb_fname_cwd);
+       if (saved_errno != 0) {
+               errno = saved_errno;
+       }
 
        if (psid)
                qt->sid    = *psid;
index 2db18cdb21cdb4c83102222cab77cb254c4c0eff..2f18e368b17502131c1490af55ad596d6e1e1c17 100644 (file)
@@ -494,7 +494,7 @@ bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
         */
        ZERO_STRUCT(D);
        id.uid = -1;
-       r = SMB_VFS_GET_QUOTA(conn, fname->base_name, SMB_USER_FS_QUOTA_TYPE,
+       r = SMB_VFS_GET_QUOTA(conn, fname, SMB_USER_FS_QUOTA_TYPE,
                              id, &D);
        if (r == -1 && errno != ENOSYS) {
                goto try_group_quota;
@@ -516,13 +516,13 @@ bool disk_quotas(connection_struct *conn, struct smb_filename *fname,
 
                id.uid = fname->st.st_ex_uid;
                become_root();
-               r = SMB_VFS_GET_QUOTA(conn, fname->base_name,
+               r = SMB_VFS_GET_QUOTA(conn, fname,
                                      SMB_USER_QUOTA_TYPE, id, &D);
                save_errno = errno;
                unbecome_root();
                errno = save_errno;
        } else {
-               r = SMB_VFS_GET_QUOTA(conn, fname->base_name,
+               r = SMB_VFS_GET_QUOTA(conn, fname,
                                      SMB_USER_QUOTA_TYPE, id, &D);
        }
 
@@ -560,7 +560,7 @@ try_group_quota:
         */
        ZERO_STRUCT(D);
        id.gid = -1;
-       r = SMB_VFS_GET_QUOTA(conn, fname->base_name, SMB_GROUP_FS_QUOTA_TYPE,
+       r = SMB_VFS_GET_QUOTA(conn, fname, SMB_GROUP_FS_QUOTA_TYPE,
                              id, &D);
        if (r == -1 && errno != ENOSYS) {
                return false;
@@ -572,7 +572,7 @@ try_group_quota:
        id.gid = getegid();
 
        ZERO_STRUCT(D);
-       r = SMB_VFS_GET_QUOTA(conn, fname->base_name, SMB_GROUP_QUOTA_TYPE, id,
+       r = SMB_VFS_GET_QUOTA(conn, fname, SMB_GROUP_QUOTA_TYPE, id,
                              &D);
 
        if (r == -1) {
index f91e9e33a021e4f1f96e41fcfc6905b5ae2c8a24..7177f882a0c0090ab1dbbe16e2237a384d70e0e4 100644 (file)
@@ -1478,12 +1478,14 @@ uint64_t smb_vfs_call_disk_free(struct vfs_handle_struct *handle,
                        bsize, dfree, dsize);
 }
 
-int smb_vfs_call_get_quota(struct vfs_handle_struct *handle, const char *path,
-                          enum SMB_QUOTA_TYPE qtype, unid_t id,
-                          SMB_DISK_QUOTA *qt)
+int smb_vfs_call_get_quota(struct vfs_handle_struct *handle,
+                               const struct smb_filename *smb_fname,
+                               enum SMB_QUOTA_TYPE qtype,
+                               unid_t id,
+                               SMB_DISK_QUOTA *qt)
 {
        VFS_FIND(get_quota);
-       return handle->fns->get_quota_fn(handle, path, qtype, id, qt);
+       return handle->fns->get_quota_fn(handle, smb_fname, qtype, id, qt);
 }
 
 int smb_vfs_call_set_quota(struct vfs_handle_struct *handle,