Disable grace period/times remote setting
Upstream removed this feature because it has never worked and it cannot work with current RPC quota protocol. Confusing synopses have been justified.
This commit is contained in:
parent
40601f79cc
commit
9c033539b4
@ -0,0 +1,85 @@
|
||||
From 8d4c4a761c27a81d96ae8c49e1b8d32d66b6751e Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kara <jack@suse.cz>
|
||||
Date: Tue, 8 Mar 2011 23:36:47 +0100
|
||||
Subject: [PATCH 1/2] Fix synopsis and properly report errors during remote grace period setting
|
||||
|
||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||
---
|
||||
edquota.8 | 2 ++
|
||||
setquota.8 | 4 +---
|
||||
setquota.c | 11 ++++++++---
|
||||
3 files changed, 11 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/edquota.8 b/edquota.8
|
||||
index 4b1406b..2ef4cb6 100644
|
||||
--- a/edquota.8
|
||||
+++ b/edquota.8
|
||||
@@ -38,6 +38,8 @@ edquota \- edit user quotas
|
||||
.BR \-u \ |
|
||||
.B \-g
|
||||
] [
|
||||
+.B \-rm
|
||||
+] [
|
||||
.B \-F
|
||||
.I format-name
|
||||
] [
|
||||
diff --git a/setquota.8 b/setquota.8
|
||||
index e3ac7e0..6c3dc88 100644
|
||||
--- a/setquota.8
|
||||
+++ b/setquota.8
|
||||
@@ -67,8 +67,6 @@ setquota \- set disk quotas
|
||||
.B setquota
|
||||
.B \-t
|
||||
[
|
||||
-.B \-m
|
||||
-] [
|
||||
.B \-u
|
||||
|
|
||||
.B \-g
|
||||
@@ -86,7 +84,7 @@ setquota \- set disk quotas
|
||||
.B setquota
|
||||
.B \-T
|
||||
[
|
||||
-.B \-m
|
||||
+.B \-rm
|
||||
] [
|
||||
.B \-u
|
||||
|
|
||||
diff --git a/setquota.c b/setquota.c
|
||||
index 5d2734b..d1cffcb 100644
|
||||
--- a/setquota.c
|
||||
+++ b/setquota.c
|
||||
@@ -58,7 +58,7 @@ static void usage(void)
|
||||
setquota [-u|-g] %1$s[-F quotaformat] <-p protouser|protogroup> <user|group> -a|<filesystem>...\n\
|
||||
setquota [-u|-g] %1$s[-F quotaformat] -b [-c] -a|<filesystem>...\n\
|
||||
setquota [-u|-g] [-F quotaformat] -t <blockgrace> <inodegrace> -a|<filesystem>...\n\
|
||||
- setquota [-u|-g] [-F quotaformat] <user|group> -T <blockgrace> <inodegrace> -a|<filesystem>...\n\n\
|
||||
+ setquota [-u|-g] %1$s[-F quotaformat] <user|group> -T <blockgrace> <inodegrace> -a|<filesystem>...\n\n\
|
||||
-u, --user set limits for user\n\
|
||||
-g, --group set limits for group\n\
|
||||
-a, --all set limits for all filesystems\n\
|
||||
@@ -372,14 +372,19 @@ static int batch_setlimits(struct quota_handle **handles)
|
||||
/* Set grace times */
|
||||
static int setgraces(struct quota_handle **handles)
|
||||
{
|
||||
- int i;
|
||||
+ int i, ret = 0;
|
||||
|
||||
for (i = 0; handles[i]; i++) {
|
||||
+ if (handles[i]->qh_ops->write_info) {
|
||||
+ errstr(_("Setting grace period on %s is not supported.\n"), handles[i]->qh_quotadev);
|
||||
+ ret = -1;
|
||||
+ continue;
|
||||
+ }
|
||||
handles[i]->qh_info.dqi_bgrace = toset.dqb_btime;
|
||||
handles[i]->qh_info.dqi_igrace = toset.dqb_itime;
|
||||
mark_quotafile_info_dirty(handles[i]);
|
||||
}
|
||||
- return 0;
|
||||
+ return ret;
|
||||
}
|
||||
|
||||
/* Set grace times for individual user */
|
||||
--
|
||||
1.7.4
|
||||
|
||||
95
quota-4.00_pre1-Forbid-grace-time-setting-over-RPC.patch
Normal file
95
quota-4.00_pre1-Forbid-grace-time-setting-over-RPC.patch
Normal file
@ -0,0 +1,95 @@
|
||||
From 418a9f20ee870953790b4331327ccb24ca8f1e47 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kara <jack@suse.cz>
|
||||
Date: Wed, 9 Mar 2011 15:37:37 +0100
|
||||
Subject: [PATCH 2/2] Forbid grace time setting over RPC
|
||||
|
||||
Testing revealed that it's not easy to set even individual grace times
|
||||
over RPC protocol. Since the usage of it is limited, just disallow that.
|
||||
|
||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||
---
|
||||
edquota.8 | 2 --
|
||||
edquota.c | 8 ++++++--
|
||||
setquota.8 | 2 --
|
||||
setquota.c | 6 +++++-
|
||||
4 files changed, 11 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/edquota.8 b/edquota.8
|
||||
index 2ef4cb6..4b1406b 100644
|
||||
--- a/edquota.8
|
||||
+++ b/edquota.8
|
||||
@@ -38,8 +38,6 @@ edquota \- edit user quotas
|
||||
.BR \-u \ |
|
||||
.B \-g
|
||||
] [
|
||||
-.B \-rm
|
||||
-] [
|
||||
.B \-F
|
||||
.I format-name
|
||||
] [
|
||||
diff --git a/edquota.c b/edquota.c
|
||||
index c0b2f76..4d247fa 100644
|
||||
--- a/edquota.c
|
||||
+++ b/edquota.c
|
||||
@@ -80,8 +80,8 @@ void usage(void)
|
||||
#endif
|
||||
errstr(_("Usage:\n\tedquota %1$s[-u] [-F formatname] [-p username] [-f filesystem] username ...\n\
|
||||
\tedquota %1$s-g [-F formatname] [-p groupname] [-f filesystem] groupname ...\n\
|
||||
-\tedquota %1$s[-u|g] [-F formatname] [-f filesystem] -t\n\
|
||||
-\tedquota %1$s[-u|g] [-F formatname] [-f filesystem] -T username|groupname ...\n"), rpcflag);
|
||||
+\tedquota [-u|g] [-F formatname] [-f filesystem] -t\n\
|
||||
+\tedquota [-u|g] [-F formatname] [-f filesystem] -T username|groupname ...\n"), rpcflag);
|
||||
fputs(_("\n\
|
||||
-u, --user edit user data\n\
|
||||
-g, --group edit group data\n"), stderr);
|
||||
@@ -183,6 +183,10 @@ int parse_options(int argc, char **argv)
|
||||
errstr(_("Prototype name does not make sense when editing grace period or times.\n"));
|
||||
usage();
|
||||
}
|
||||
+ if (flags & FL_REMOTE && (flags & (FL_EDIT_TIMES | FL_EDIT_PERIOD))) {
|
||||
+ errstr(_("Cannot change grace times over RPC protocol.\n"));
|
||||
+ usage();
|
||||
+ }
|
||||
return optind;
|
||||
}
|
||||
|
||||
diff --git a/setquota.8 b/setquota.8
|
||||
index 6c3dc88..db9d054 100644
|
||||
--- a/setquota.8
|
||||
+++ b/setquota.8
|
||||
@@ -84,8 +84,6 @@ setquota \- set disk quotas
|
||||
.B setquota
|
||||
.B \-T
|
||||
[
|
||||
-.B \-rm
|
||||
-] [
|
||||
.B \-u
|
||||
|
|
||||
.B \-g
|
||||
diff --git a/setquota.c b/setquota.c
|
||||
index d1cffcb..fe29ec2 100644
|
||||
--- a/setquota.c
|
||||
+++ b/setquota.c
|
||||
@@ -58,7 +58,7 @@ static void usage(void)
|
||||
setquota [-u|-g] %1$s[-F quotaformat] <-p protouser|protogroup> <user|group> -a|<filesystem>...\n\
|
||||
setquota [-u|-g] %1$s[-F quotaformat] -b [-c] -a|<filesystem>...\n\
|
||||
setquota [-u|-g] [-F quotaformat] -t <blockgrace> <inodegrace> -a|<filesystem>...\n\
|
||||
- setquota [-u|-g] %1$s[-F quotaformat] <user|group> -T <blockgrace> <inodegrace> -a|<filesystem>...\n\n\
|
||||
+ setquota [-u|-g] [-F quotaformat] <user|group> -T <blockgrace> <inodegrace> -a|<filesystem>...\n\n\
|
||||
-u, --user set limits for user\n\
|
||||
-g, --group set limits for group\n\
|
||||
-a, --all set limits for all filesystems\n\
|
||||
@@ -202,6 +202,10 @@ static void parse_options(int argcnt, char **argstr)
|
||||
errstr(_("Batch mode and prototype user cannot be used together.\n"));
|
||||
usage();
|
||||
}
|
||||
+ if (flags & FL_RPC && (flags & (FL_GRACE | FL_INDIVIDUAL_GRACE))) {
|
||||
+ errstr(_("Cannot set grace times over RPC protocol.\n"));
|
||||
+ usage();
|
||||
+ }
|
||||
if (flags & FL_GRACE)
|
||||
otherargs = 2;
|
||||
else if (flags & FL_INDIVIDUAL_GRACE)
|
||||
--
|
||||
1.7.4
|
||||
|
||||
28
quota-4.00_pre1-Reverse-setgrace-condition.patch
Normal file
28
quota-4.00_pre1-Reverse-setgrace-condition.patch
Normal file
@ -0,0 +1,28 @@
|
||||
From a571f710b42f5ba76b5e577607b35a9076a76ba0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
||||
Date: Wed, 9 Mar 2011 17:52:33 +0100
|
||||
Subject: [PATCH] Reverse setgrace condition
|
||||
|
||||
Original idea is to disallow remote grace setting. The condition
|
||||
should be opposite. See
|
||||
https://sourceforge.net/tracker/index.php?func=detail&aid=3202953&group_id=18136&atid=118136
|
||||
---
|
||||
setquota.c | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/setquota.c b/setquota.c
|
||||
index fe29ec2..c012908 100644
|
||||
--- a/setquota.c
|
||||
+++ b/setquota.c
|
||||
@@ -379,7 +379,7 @@ static int setgraces(struct quota_handle **handles)
|
||||
int i, ret = 0;
|
||||
|
||||
for (i = 0; handles[i]; i++) {
|
||||
- if (handles[i]->qh_ops->write_info) {
|
||||
+ if (!handles[i]->qh_ops->write_info) {
|
||||
errstr(_("Setting grace period on %s is not supported.\n"), handles[i]->qh_quotadev);
|
||||
ret = -1;
|
||||
continue;
|
||||
--
|
||||
1.7.4
|
||||
|
||||
14
quota.spec
14
quota.spec
@ -5,7 +5,7 @@ Name: quota
|
||||
Summary: System administration tools for monitoring users' disk usage
|
||||
Epoch: 1
|
||||
Version: 4.00
|
||||
Release: 0.10.pre1%{?dist}
|
||||
Release: 0.11.pre1%{?dist}
|
||||
License: BSD and GPLv2+
|
||||
URL: http://sourceforge.net/projects/linuxquota/
|
||||
Group: System Environment/Base
|
||||
@ -66,6 +66,12 @@ Patch23: quota-4.00_pre1-Explain-meaning-of-the-second-column-in-repquota-out.pa
|
||||
Patch24: quota-4.00_pre1-Make-RPC-handle-properly-host-names-with-colons.patch
|
||||
# In upstream 4.00_pre2, SF#3195046
|
||||
Patch25: quota-4.00_pre1-Do-not-use-real-domains-in-warnquota-example.patch
|
||||
# In upstream 4.00_pre2, SF#3202953
|
||||
Patch26: quota-4.00_pre1-Fix-synopsis-and-properly-report-errors-during-remot.patch
|
||||
# In upstream 4.00_pre2, SF#3202953
|
||||
Patch27: quota-4.00_pre1-Forbid-grace-time-setting-over-RPC.patch
|
||||
# Submitted to upstream, SF#3202953
|
||||
Patch28: quota-4.00_pre1-Reverse-setgrace-condition.patch
|
||||
|
||||
%description
|
||||
The quota package contains system administration tools for monitoring
|
||||
@ -161,6 +167,9 @@ Linux/UNIX environment.
|
||||
%patch23 -p1 -b .explain_second_column_of_repquota
|
||||
%patch24 -p1 -b .hostnames_with_columns
|
||||
%patch25 -p1 -b .warnquota_domains
|
||||
%patch26 -p1 -b .fix_grace_synopsis
|
||||
%patch27 -p1 -b .forbid_rpc_grace_time
|
||||
%patch28 -p1 -b .reverse_setgrace_condition
|
||||
# quotactl(2) moved into `man-pages' package (bug #640590)
|
||||
rm -f quotactl.2
|
||||
# remove VCS files
|
||||
@ -283,6 +292,9 @@ rm -rf %{buildroot}
|
||||
|
||||
|
||||
%changelog
|
||||
* Thu Mar 10 2011 Petr Pisar <ppisar@redhat.com> - 1:4.00-0.11.pre1
|
||||
- Disable grace period/times remote setting
|
||||
|
||||
* Mon Feb 28 2011 Petr Pisar <ppisar@redhat.com> - 1:4.00-0.10.pre1
|
||||
- Do not use real domains in warnquota example
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user