return -1;
}
-static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
- unid_t id, SMB_DISK_QUOTA *dq)
+static int skel_set_quota(vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ enum SMB_QUOTA_TYPE qtype,
+ unid_t id,
+ SMB_DISK_QUOTA *dq)
{
errno = ENOSYS;
return -1;
return SMB_VFS_NEXT_GET_QUOTA(handle, fsp, qtype, id, dq);
}
-static int skel_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype,
- unid_t id, SMB_DISK_QUOTA *dq)
+static int skel_set_quota(vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ enum SMB_QUOTA_TYPE qtype,
+ unid_t id,
+ SMB_DISK_QUOTA *dq)
{
- return SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq);
+ return SMB_VFS_NEXT_SET_QUOTA(handle, fsp, qtype, id, dq);
}
static int skel_get_shadow_copy_data(vfs_handle_struct *handle,
* Version 53 - Add fstatvfs
* Version 53 - Remove statvfs
* Version 53 - Change GET_QUOTA to take a fsp instead of a name
+ * Version 53 - Add fsp to SET_QUOTA
*/
#define SMB_VFS_INTERFACE_VERSION 53
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 (*set_quota_fn)(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ 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 (*fstatvfs_fn)(struct vfs_handle_struct *handle,
struct files_struct *fsp,
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,
+ struct files_struct *fsp,
+ enum SMB_QUOTA_TYPE qtype,
+ unid_t id,
SMB_DISK_QUOTA *qt);
int smb_vfs_call_get_shadow_copy_data(struct vfs_handle_struct *handle,
struct files_struct *fsp,
unid_t id,
SMB_DISK_QUOTA *dq);
int vfs_not_implemented_set_quota(vfs_handle_struct *handle,
+ struct files_struct *fsp,
enum SMB_QUOTA_TYPE qtype,
- unid_t id, SMB_DISK_QUOTA *dq);
+ unid_t id,
+ SMB_DISK_QUOTA *dq);
int vfs_not_implemented_get_shadow_copy_data(vfs_handle_struct *handle,
files_struct *fsp,
struct shadow_copy_data *shadow_copy_data,
#define SMB_VFS_NEXT_GET_QUOTA(handle, fsp, qtype, id, qt) \
smb_vfs_call_get_quota((handle)->next, (fsp), (qtype), (id), (qt))
-#define SMB_VFS_SET_QUOTA(conn, qtype, id, qt) \
- smb_vfs_call_set_quota((conn)->vfs_handles, (qtype), (id), (qt))
-#define SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt) \
- smb_vfs_call_set_quota((handle)->next, (qtype), (id), (qt))
+#define SMB_VFS_SET_QUOTA(fsp, qtype, id, qt) \
+ smb_vfs_call_set_quota( \
+ (fsp)->conn->vfs_handles, (fsp), (qtype), (id), (qt))
+#define SMB_VFS_NEXT_SET_QUOTA(handle, fsp, qtype, id, qt) \
+ smb_vfs_call_set_quota((handle)->next, (fsp), (qtype), (id), (qt))
#define SMB_VFS_GET_SHADOW_COPY_DATA(fsp,shadow_copy_data,labels) \
smb_vfs_call_get_shadow_copy_data((fsp)->conn->vfs_handles, (fsp), (shadow_copy_data), (labels))
#endif
}
-static int vfswrap_set_quota(struct vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt)
+static int vfswrap_set_quota(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ enum SMB_QUOTA_TYPE qtype,
+ unid_t id,
+ SMB_DISK_QUOTA *qt)
{
#ifdef HAVE_SYS_QUOTAS
+ struct smb_filename *smb_fname = fsp->fsp_name;
int result;
START_PROFILE_X(SNUM(handle->conn), syscall_set_quota);
- result = sys_set_quota(handle->conn->connectpath, qtype, id, qt);
+ result = sys_set_quota(smb_fname->base_name, qtype, id, qt);
END_PROFILE_X(syscall_set_quota);
return result;
#else
return ret;
}
-static int default_quota_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *dq)
+static int default_quota_set_quota(vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ enum SMB_QUOTA_TYPE qtype,
+ unid_t id,
+ SMB_DISK_QUOTA *dq)
{
int ret = -1;
break;
}
- if ((ret=SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, dq))!=0) {
+ ret = SMB_VFS_NEXT_SET_QUOTA(handle, fsp, qtype, id, dq);
+ if (ret != 0) {
return ret;
}
{
unid_t qid;
qid.uid = DEFAULT_QUOTA_UID(handle);
- ret = SMB_VFS_NEXT_SET_QUOTA(handle, SMB_USER_QUOTA_TYPE, qid, dq);
+ ret = SMB_VFS_NEXT_SET_QUOTA(
+ handle,
+ fsp,
+ SMB_USER_QUOTA_TYPE,
+ qid,
+ dq);
}
break;
#ifdef HAVE_GROUP_QUOTA
{
unid_t qid;
qid.gid = DEFAULT_QUOTA_GID(handle);
- ret = SMB_VFS_NEXT_SET_QUOTA(handle, SMB_GROUP_QUOTA_TYPE, qid, dq);
+ ret = SMB_VFS_NEXT_SET_QUOTA(
+ handle,
+ fsp,
+ SMB_GROUP_QUOTA_TYPE,
+ qid,
+ dq);
}
break;
#endif /* HAVE_GROUP_QUOTA */
}
static int smb_full_audit_set_quota(struct vfs_handle_struct *handle,
- enum SMB_QUOTA_TYPE qtype, unid_t id,
- SMB_DISK_QUOTA *qt)
+ struct files_struct *fsp,
+ enum SMB_QUOTA_TYPE qtype,
+ unid_t id,
+ SMB_DISK_QUOTA *qt)
{
int result;
- result = SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt);
+ result = SMB_VFS_NEXT_SET_QUOTA(handle, fsp, qtype, id, qt);
do_log(SMB_VFS_OP_SET_QUOTA, errmsg_unix(result), handle, "");
return -1;
}
-static int
-vfs_gluster_set_quota(struct vfs_handle_struct *handle,
- enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt)
+static int vfs_gluster_set_quota(struct vfs_handle_struct *handle,
+ struct files_struct *fsp,
+ enum SMB_QUOTA_TYPE qtype,
+ unid_t id,
+ SMB_DISK_QUOTA *qt)
{
errno = ENOSYS;
return -1;
_PUBLIC_
int vfs_not_implemented_set_quota(vfs_handle_struct *handle,
+ struct files_struct *fsp,
enum SMB_QUOTA_TYPE qtype,
- unid_t id, SMB_DISK_QUOTA *dq)
+ unid_t id,
+ SMB_DISK_QUOTA *dq)
{
errno = ENOSYS;
return -1;
}
static int smb_time_audit_set_quota(struct vfs_handle_struct *handle,
- enum SMB_QUOTA_TYPE qtype, unid_t id,
+ struct files_struct *fsp,
+ enum SMB_QUOTA_TYPE qtype,
+ unid_t id,
SMB_DISK_QUOTA *qt)
{
int result;
double timediff;
clock_gettime_mono(&ts1);
- result = SMB_VFS_NEXT_SET_QUOTA(handle, qtype, id, qt);
+ result = SMB_VFS_NEXT_SET_QUOTA(handle, fsp, qtype, id, qt);
clock_gettime_mono(&ts2);
timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
dom_sid_str_buf(psid, &buf)));
}
- ret = SMB_VFS_SET_QUOTA(fsp->conn, qtype, id, &D);
+ ret = SMB_VFS_SET_QUOTA(fsp, qtype, id, &D);
return ret;
}
}
int smb_vfs_call_set_quota(struct vfs_handle_struct *handle,
- enum SMB_QUOTA_TYPE qtype, unid_t id,
+ struct files_struct *fsp,
+ enum SMB_QUOTA_TYPE qtype,
+ unid_t id,
SMB_DISK_QUOTA *qt)
{
VFS_FIND(set_quota);
- return handle->fns->set_quota_fn(handle, qtype, id, qt);
+ return handle->fns->set_quota_fn(handle, fsp, qtype, id, qt);
}
int smb_vfs_call_get_shadow_copy_data(struct vfs_handle_struct *handle,