Signed-off-by: Andrey Albershteyn <aalbersh@xxxxxxxxxx> --- quota/report.c | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/quota/report.c b/quota/report.c index 074abbc1..c79e95ab 100644 --- a/quota/report.c +++ b/quota/report.c @@ -161,8 +161,10 @@ dump_limits_any_type( struct group *g; setgrent(); while ((g = getgrent()) != NULL) { - get_quota(&d, g->gr_gid, NULL, type, mount->fs_name, 0); - dump_file(fp, &d, mount->fs_name); + if (get_quota(&d, g->gr_gid, NULL, type, mount->fs_name, 0) && + !(lower && (d.d_id < lower)) && + !(upper && (d.d_id > upper))) + dump_file(fp, &d, mount->fs_name); } endgrent(); break; @@ -171,8 +173,10 @@ dump_limits_any_type( struct fs_project *p; setprent(); while ((p = getprent()) != NULL) { - get_quota(&d, p->pr_prid, NULL, type, mount->fs_name, 0); - dump_file(fp, &d, mount->fs_name); + if (get_quota(&d, p->pr_prid, NULL, type, mount->fs_name, 0) && + !(lower && (d.d_id < lower)) && + !(upper && (d.d_id > upper))) + dump_file(fp, &d, mount->fs_name); } endprent(); break; @@ -181,8 +185,10 @@ dump_limits_any_type( struct passwd *u; setpwent(); while ((u = getpwent()) != NULL) { - get_quota(&d, u->pw_uid, NULL, type, mount->fs_name, 0); - dump_file(fp, &d, mount->fs_name); + if (get_quota(&d, u->pw_uid, NULL, type, mount->fs_name, 0) && + !(lower && (d.d_id < lower)) && + !(upper && (d.d_id > upper))) + dump_file(fp, &d, mount->fs_name); } endpwent(); break; @@ -474,8 +480,10 @@ report_user_mount( if (!(flags & GETNEXTQUOTA_FLAG)) { setpwent(); while ((u = getpwent()) != NULL) { - if (get_quota(&d, u->pw_uid, NULL, XFS_USER_QUOTA, mount->fs_name, - flags)) { + if (get_quota(&d, u->pw_uid, NULL, XFS_USER_QUOTA, + mount->fs_name, flags) && + !(lower && (d.d_id < lower)) && + !(upper && (d.d_id > upper))) { report_mount(fp, &d, u->pw_name, form, XFS_USER_QUOTA, mount, flags); flags |= NO_HEADER_FLAG; @@ -515,7 +523,9 @@ report_group_mount( setgrent(); while ((g = getgrent()) != NULL) { if (get_quota(&d, g->gr_gid, NULL, XFS_GROUP_QUOTA, - mount->fs_name, flags)) { + mount->fs_name, flags) && + !(lower && (d.d_id < lower)) && + !(upper && (d.d_id > upper))) { report_mount(fp, &d, g->gr_name, form, XFS_GROUP_QUOTA, mount, flags); flags |= NO_HEADER_FLAG; @@ -557,7 +567,9 @@ report_project_mount( * isn't defined */ if (get_quota(&d, 0, NULL, XFS_PROJ_QUOTA, - mount->fs_name, flags)) { + mount->fs_name, flags) && + !(lower && (d.d_id < lower)) && + !(upper && (d.d_id > upper))) { report_mount(fp, &d, NULL, form, XFS_PROJ_QUOTA, mount, flags); flags |= NO_HEADER_FLAG; } @@ -566,7 +578,9 @@ report_project_mount( setprent(); while ((p = getprent()) != NULL) { if (get_quota(&d, p->pr_prid, NULL, XFS_PROJ_QUOTA, - mount->fs_name, flags)) { + mount->fs_name, flags) && + !(lower && (d.d_id < lower)) && + !(upper && (d.d_id > upper))) { report_mount(fp, &d, p->pr_name, form, XFS_PROJ_QUOTA, mount, flags); flags |= NO_HEADER_FLAG; -- 2.27.0