From: Volker Lendecke Date: Wed, 11 Feb 2026 11:29:54 +0000 (+0100) Subject: vfs: Add "fsp" to SMB_VFS_SET_QUOTA X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a7e9e82e8562134183db20a335ee7ba93e3e4bb7;p=thirdparty%2Fsamba.git vfs: Add "fsp" to SMB_VFS_SET_QUOTA Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index ea54fd79bd1..9571eb9244d 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -67,8 +67,11 @@ static int skel_get_quota(vfs_handle_struct *handle, 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; diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index da3897d0e9e..aa186d7ef17 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -66,10 +66,13 @@ static int skel_get_quota(vfs_handle_struct *handle, 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, diff --git a/source3/include/vfs.h b/source3/include/vfs.h index c17e41fa0ee..92142cf8184 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -402,6 +402,7 @@ * 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 @@ -997,7 +998,11 @@ struct vfs_fn_pointers { 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, @@ -1453,7 +1458,9 @@ int smb_vfs_call_get_quota(struct vfs_handle_struct *handle, 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, @@ -1886,8 +1893,10 @@ int vfs_not_implemented_get_quota(vfs_handle_struct *handle, 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, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 5d41b16033e..70c780f679f 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -52,10 +52,11 @@ #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)) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index da41eefaa5d..d17462d6f67 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -139,13 +139,18 @@ static int vfswrap_get_quota(struct vfs_handle_struct *handle, #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 diff --git a/source3/modules/vfs_default_quota.c b/source3/modules/vfs_default_quota.c index 612a65f28b4..3f66264c38e 100644 --- a/source3/modules/vfs_default_quota.c +++ b/source3/modules/vfs_default_quota.c @@ -158,7 +158,11 @@ static int default_quota_get_quota(vfs_handle_struct *handle, 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; @@ -191,7 +195,8 @@ static int default_quota_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYP 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; } @@ -206,7 +211,12 @@ static int default_quota_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYP { 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 @@ -214,7 +224,12 @@ static int default_quota_set_quota(vfs_handle_struct *handle, enum SMB_QUOTA_TYP { 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 */ diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 1c46d32dec5..f2aea7e6a74 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -853,12 +853,14 @@ static int smb_full_audit_get_quota(struct vfs_handle_struct *handle, } 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, ""); diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 1adf62e9ff1..212cd081e8c 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -555,9 +555,11 @@ static int vfs_gluster_get_quota(struct vfs_handle_struct *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; diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c index 33d610d3d49..839844cd352 100644 --- a/source3/modules/vfs_not_implemented.c +++ b/source3/modules/vfs_not_implemented.c @@ -66,8 +66,10 @@ int vfs_not_implemented_get_quota(vfs_handle_struct *handle, _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; diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 73594c4bebf..2b1ae2587e6 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -222,7 +222,9 @@ static int smb_time_audit_get_quota(struct vfs_handle_struct *handle, } 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; @@ -230,7 +232,7 @@ static int smb_time_audit_set_quota(struct vfs_handle_struct *handle, 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; diff --git a/source3/smbd/ntquotas.c b/source3/smbd/ntquotas.c index 0b8675d0ec5..786c48cbc2b 100644 --- a/source3/smbd/ntquotas.c +++ b/source3/smbd/ntquotas.c @@ -144,7 +144,7 @@ int vfs_set_ntquota(files_struct *fsp, enum SMB_QUOTA_TYPE qtype, struct dom_sid 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; } diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index f6a36eab2d8..06601fb90f8 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -1462,11 +1462,13 @@ int smb_vfs_call_get_quota(struct vfs_handle_struct *handle, } 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,