4.02 bump

This commit is contained in:
Petr Písař 2014-11-26 13:46:59 +01:00
parent 466a9622cf
commit c75f5e0a4f
26 changed files with 74 additions and 2206 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ quota-3.17.tar.gz
/quota-4.00-pre1.tar.gz
/quota-4.00.tar.gz
/quota-4.01.tar.gz
/quota-4.02.tar.gz

View File

@ -1,32 +0,0 @@
--- quota-tools/Makefile.in.orig 2008-01-24 06:52:54.658544000 -0500
+++ quota-tools/Makefile.in 2008-01-24 06:56:58.930806000 -0500
@@ -52,6 +52,10 @@ LIBOBJS += @LIBMALLOC@
all: $(PROGS)
+
+svc_socket.o rquota_server.o rquota_svc.o $(filter-out rquota_xdr.o,$(LIBOBJS)): %.o: %.c
+ $(CC) $(CFLAGS) -fpie -c $<
+
clean:
-rm -f core *.o .*.d
@@ -130,7 +134,8 @@ setquota: setquota.o quotaops.o $(LIBOBJ
convertquota: convertquota.o $(LIBOBJS)
rpc.rquotad: rquota_server.o rquota_svc.o svc_socket.o $(LIBOBJS)
- $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+ $(CC) $(LDFLAGS) -pie -o $@ $^ $(LIBS)
+ @if readelf -d $@|fgrep -q TEXTREL; then echo "*** Text relocation"; false; else true; fi
ifneq ($(NETLINKLIBS),)
quota_nld: quota_nld.o $(LIBOBJS)
@@ -146,7 +151,7 @@ rquota_xdr.c: rquota.x
$(RPCGEN) -c -o $@ $<
rquota_xdr.o: rquota_xdr.c rquota.h
- $(CC) $(CFLAGS) -Wno-unused -c $<
+ $(CC) $(CFLAGS) -Wno-unused -fpie -c $<
rquota_clnt.c: rquota.x
$(RPCGEN) -l -o $@ $<

View File

@ -1,96 +0,0 @@
From 2e0023997cf6fe1e2eee678ba66371642e212829 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 16 Oct 2013 16:48:26 +0200
Subject: [PATCH 1/4] Add quotagrpadmins(5) manual page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
Makefile.in | 2 ++
quotagrpadmins.5 | 28 ++++++++++++++++++++++++++++
warnquota.8 | 5 ++++-
3 files changed, 34 insertions(+), 1 deletion(-)
create mode 100644 quotagrpadmins.5
diff --git a/Makefile.in b/Makefile.in
index 84fafce..5800029 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -90,6 +90,7 @@ install: all @INSTMO@
-$(INSTALL) -m $(DEF_CONF_MODE) quotagrpadmins $(ROOTDIR)$(sysconfdir)
-mkdir -p $(ROOTDIR)$(mandir)/man1
-mkdir -p $(ROOTDIR)$(mandir)/man3
+ -mkdir -p $(ROOTDIR)$(mandir)/man5
-mkdir -p $(ROOTDIR)$(mandir)/man8
-$(INSTALL) -m 755 -d $(ROOTDIR)$(includedir)/rpcsvc
-$(INSTALL) -m 644 rquota.h rquota.x $(ROOTDIR)$(includedir)/rpcsvc
@@ -100,6 +101,7 @@ ifneq ($(NETLINKLIBS),)
endif
-$(INSTALL) -m $(DEF_MAN_MODE) *.1 $(ROOTDIR)$(mandir)/man1
-$(INSTALL) -m $(DEF_MAN_MODE) *.3 $(ROOTDIR)$(mandir)/man3
+ -$(INSTALL) -m $(DEF_MAN_MODE) *.5 $(ROOTDIR)$(mandir)/man5
-$(INSTALL) -m $(DEF_MAN_MODE) *.8 $(ROOTDIR)$(mandir)/man8
quotaon: quotaon.o quotaon_xfs.o $(LIBOBJS)
diff --git a/quotagrpadmins.5 b/quotagrpadmins.5
new file mode 100644
index 0000000..fef1e3a
--- /dev/null
+++ b/quotagrpadmins.5
@@ -0,0 +1,28 @@
+.TH QUOTAGRPADMINS 5
+.SH NAME
+quotagrpadmins \- users responsible for group disk usage
+.SH SYNOPSIS
+.B /etc/quotagrpadmins
+.SH DESCRIPTION
+The
+.B quotagrpadmins
+file lists administrators of user groups who will receive a warning if
+.B warnquota --group
+command finds a group exceeding its disk usage limits.
+.P
+Each line consists of a group name followed by a colon and an user name. White
+space characters surrounding the names are allowed. Empty lines or lines
+starting with a hash sign or a semicolon are ignored.
+.SH EXAMPLE
+.PP
+# comment
+.RS 0
+users: root
+.SH FILES
+.PD 0
+.TP 20
+.B /etc/quotagrpadmins
+list of group administrators
+.PD
+.SH SEE ALSO
+.BR warnquota (8).
diff --git a/warnquota.8 b/warnquota.8
index 8427488..836290d 100644
--- a/warnquota.8
+++ b/warnquota.8
@@ -58,7 +58,9 @@ Use
.I adminsfile
instead of
.I /etc/quotagrpadmins
-as a file with administrators of the groups.
+as a file with administrators of the groups (see
+.BR quotagrpadmins (5)
+for syntax).
.TP
.B -u, --user
check whether users are not exceeding quotas (default).
@@ -102,6 +104,7 @@ default set of users
.PD
.SH "SEE ALSO"
.BR quota (1),
+.BR quotagrpadmins (5),
.BR cron (8),
.BR edquota (8).
.SH AUTHORS
--
1.8.3.1

View File

@ -1,96 +0,0 @@
From 801386a31d0ae47779cf74cbb4f343be346a07db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 6 Mar 2013 11:21:50 +0100
Subject: [PATCH 1/4] Add quotasync(1) manual page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
quotasync.1 | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)
create mode 100644 quotasync.1
diff --git a/quotasync.1 b/quotasync.1
new file mode 100644
index 0000000..e968403
--- /dev/null
+++ b/quotasync.1
@@ -0,0 +1,72 @@
+.TH QUOTASYNC 1
+.SH NAME
+quotasync \- synchronize in-kernel file system usage and limits to disk format
+.SH SYNOPSIS
+.B quotasync
+[
+.B -ug
+]
+.IR mount-point ...
+.br
+.B quotasync
+[
+.B -ug
+]
+.B -a
+.br
+.B quotasync
+.B -h
+|
+.B -V
+.SH DESCRIPTION
+.B quotasync
+flushes file system usage and limits from kernel memory to quota files stored
+in the file system. By default only the user quotas are synchronized.
+.P
+This tool can be useful if you want to display accurate quotas by tools that
+parse quota files, like
+.BR repquota (8).
+.SH OPTIONS
+.TP
+.B -u, --user
+Synchronize user usage and limits.
+.TP
+.B -g, --group
+Synchronize group usage and limits.
+.TP
+.B -a, --all
+Synchronize usage and limits on all file systems. You have to specify this
+option or to specify desired file systems.
+.TP
+.B -V, --version
+Show program version information and exit.
+.TP
+.B -h, --help
+Show program usage and exit.
+.SH DIAGNOSTICS
+If requested synchronization fails, or invalid option is given,
+.B quotasync
+will terminate with non-zero exit code. Otherwise it will return zero.
+.SH FILES
+.PD 0
+.TP 16
+.B aquota.user " or " aquota.group
+Quota file at the file system root (version 2 quota, non-XFS/GFS2 file systems).
+.TP 16
+.B quota.user " or " quota.group
+Quota file at the file system root (version 1 quota, non-XFS/GFS2 file systems).
+.TP 16
+.B /etc/mtab
+List of mounted file systems maintained by user space.
+.TP 16
+.B /proc/mounts
+List of mounted file systems maintained by kernel.
+.PD
+.SH SEE ALSO
+.BR quota (1),
+.BR quotactl (2),
+.BR mount (8),
+.BR quotacheck (8),
+.BR quotaon (8),
+.BR repquota (8),
+.BR warnquota (8).
--
1.8.1.4

View File

@ -1,78 +0,0 @@
From e0d078f1fdf1c91602d72b402e3accc3b7c8cb58 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 17 Oct 2013 14:40:35 +0200
Subject: [PATCH 2/4] Add quotatab(5) manual page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotatab.5 | 31 +++++++++++++++++++++++++++++++
warnquota.8 | 5 ++++-
2 files changed, 35 insertions(+), 1 deletion(-)
create mode 100644 quotatab.5
diff --git a/quotatab.5 b/quotatab.5
new file mode 100644
index 0000000..96d3608
--- /dev/null
+++ b/quotatab.5
@@ -0,0 +1,31 @@
+.TH QUOTATAB 5
+.SH NAME
+quotatab \- Descriptions of devices with disk quotas
+.SH SYNOPSIS
+.B /etc/quotatab
+.SH DESCRIPTION
+The
+.B quotatab
+file lists human descriptions of devices for the purpose of
+.BR warnquota (8)
+notifications.
+.P
+Each line consists of a device path name followed by a colon and
+a description. White space, apostrophe, and double quote characters
+surrounding the names and descriptions will be stripped. The description field
+can encode a new-line as a pipe character.
+.P
+Empty lines or lines starting with a hash sign or a semicolon are ignored.
+.SH EXAMPLE
+.PP
+# comment
+.RS 0
+/dev/sda2: Home directories.|This becomes second line.
+.SH FILES
+.PD 0
+.TP 20
+.B /etc/quotatab
+list of device descriptions
+.PD
+.SH SEE ALSO
+.BR warnquota (8).
diff --git a/warnquota.8 b/warnquota.8
index 836290d..b998f19 100644
--- a/warnquota.8
+++ b/warnquota.8
@@ -44,7 +44,9 @@ Use
.I quotatab
instead of
.I /etc/quotatab
-as file with device description strings (see example file for syntax).
+as file with device description strings (see
+.BR quotatab (5)
+for syntax).
.TP
.B -c, --config=\f2configfile\f1
Use
@@ -104,6 +106,7 @@ default set of users
.PD
.SH "SEE ALSO"
.BR quota (1),
+.BR quotatab (5),
.BR quotagrpadmins (5),
.BR cron (8),
.BR edquota (8).
--
1.8.3.1

View File

@ -1,231 +0,0 @@
From 91db972ea2f4065974811655847be4d52b7caee9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 17 Oct 2013 17:01:07 +0200
Subject: [PATCH 3/4] Add warnquota.conf(5) manual page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
warnquota.8 | 5 +-
warnquota.conf.5 | 184 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 188 insertions(+), 1 deletion(-)
create mode 100644 warnquota.conf.5
diff --git a/warnquota.8 b/warnquota.8
index b998f19..e675f4a 100644
--- a/warnquota.8
+++ b/warnquota.8
@@ -53,7 +53,9 @@ Use
.I configfile
instead of
.I /etc/warnquota.conf
-as configuration file (see example file for syntax).
+as configuration file (see
+.BR warnquota.conf (5)
+for syntax).
.TP
.B -a, --admins-file=\f2adminsfile\f1
Use
@@ -108,6 +110,7 @@ default set of users
.BR quota (1),
.BR quotatab (5),
.BR quotagrpadmins (5),
+.BR warnquota.conf (5),
.BR cron (8),
.BR edquota (8).
.SH AUTHORS
diff --git a/warnquota.conf.5 b/warnquota.conf.5
new file mode 100644
index 0000000..56e1439
--- /dev/null
+++ b/warnquota.conf.5
@@ -0,0 +1,184 @@
+.TH WARNQUOTA.CONF 5
+.SH NAME
+warnquota.conf \- configuration for warnquota
+.SH SYNOPSIS
+.B /etc/warnquota.conf
+.SH DESCRIPTION
+The
+.B warnquota.conf
+file stores a configuration for
+.BR warnquota (8)
+tool which is used to notify an user or a group who exceeds its disk quota
+limits.
+.P
+The syntax is an option name followed by a equal sign and the option value.
+White space characters surrounding the option names and values are allowed.
+.P
+Empty lines or lines starting with a hash sign or a semicolon are ignored.
+.P
+An option value can but does not have to be quoted. The value can span
+across multiple lines provided each previous line ends with a backslash.
+.P
+Some option values can contain formatting sequences which will be expanded to
+their respective values. Following sequences are recognizes:
+.P
+.PD 0
+.TP 20
+.B %d
+domain name
+.TP
+.B %h
+host name
+.TP
+.BR "%i" ", " "%s"
+user or group name
+.TP
+.B %%
+literal % character
+.TP
+.B |
+new-line character
+.PD
+.SH OPTIONS
+.PD 0
+.TP 20
+.B CC_BEFORE
+Send to copy-carbon address only when an user has less than specified grace time
+left. Value is a number followed by a time unit. Known units are
+.IR seconds ,
+.IR minutes ,
+.IR hours ", and"
+.IR days .
+Example:
+.I 5 days
+.TP
+.B CC_TO
+An e-mail address to put into copy-carbon (CC:) recipient header. Default
+value is
+.IR root .
+.TP
+.B CHARSET
+Defines character set for sent e-mails. Default value will be current locale
+character set used when executing warnquota command, if locale is not either
+.I C
+or
+.IR POSIX .
+Otherwise none character set will be specified in the e-mails.
+.TP
+.B FROM
+Defines From: e-email address. Default value is
+.IR "support@localhost" .
+.TP
+.B GROUP_MESSAGE
+A text sent as an e-mail body if a group exceeds its limits. This option
+recognizes formatting sequences.
+.TP
+.B GROUP_SIGNATURE
+A signature text appended to notification for a group. Default value is
+a general explanation utilizing
+.B SUPPORT
+and
+.B PHONE
+values. This option recognizes formatting sequences.
+.TP
+.B LDAP_BASEDN
+Base distinguished name for LDAP queries.
+.TP
+.B LDAP_BINDDN
+Bind distinguished name for LDAP queries.
+.TP
+.B LDAP_BINDPW
+Bind password for LDAP queries.
+.TP
+.B LDAP_DEFAULT_MAIL_DOMAIN
+Default e-mail address domain of searched user if given LDAP attribute does
+not specify any.
+.TP
+.B LDAP_HOST
+LDAP server name to connect to if
+.B LDAP_URI
+is not defined.
+.TP
+.B LDAP_MAIL
+A boolean controlling if LDAP has to be used to look up an user's e-mail
+address. Possible values are
+.I true
+and
+.IR false .
+Default value is
+.IR false .
+.TP
+.B LDAP_MAIL_ATTRIBUTE
+The LDAP attribute which holds user's e-mail address.
+.TP
+.B LDAP_PORT
+LDAP server port number to connect to if
+.B LDAP_URI
+is not defined.
+.TP
+.B LDAP_SEARCH_ATTRIBUTE
+The LDAP attribute which holds user's ID to look up.
+.TP
+.B LDAP_URI
+The URL of LDAP server to use to search user's e-mail addresses. This option
+takes preference over
+.B LDAP_HOST
+and
+.BR LDAP_PORT .
+Example:
+.I ldaps://example.com:389/
+.TP
+.B MESSAGE
+A beginning of text sent as an e-mail body if a user exceeds his limits. This
+option recognizes formatting sequences.
+.TP
+.B MAIL_CMD
+The command to execute to send an e-mail. The e-mail text including all
+headers is passed to the standard input of the command. Default value is
+.IR "/usr/lib/sendmail -t" .
+.TP
+.B MAILDEV
+The device with disk quotas to exclude from sending notifications if there are
+exceeded limits. This option should identify the device where mail boxes are
+stored to prevent from bouncing the warnquota notification by local MDA due to
+no space for storing new e-mails. Special value
+.I any
+denotes all devices.
+.TP
+.B PHONE
+The telephone contact to the user support. Default value is
+.IR "(xxx) xxx-xxxx or (yyy) yyy-yyyy" .
+.TP
+.B SIGNATURE
+The end of e-mail body if a user exceeds its limits. Default value is
+a general explanation utilizing
+.B SUPPORT
+and
+.B PHONE
+values. This option recognizes formatting sequences.
+.TP
+.B SUBJECT
+The text to put into Subject: header. Default value is
+.IR "Disk Quota usage on system" .
+.TP
+.B SUPPORT
+The contact to the user support. Default value is
+.IR "support@localhost" .
+.SH EXAMPLE
+.PP
+# comment
+.RS 0
+FROM = root@example.com
+.RS 0
+SUPPORT = support@example.com
+.RS 0
+PHONE = 1234
+.SH FILES
+.PD 0
+.TP 20
+.B /etc/warnquota.conf
+configuration for
+.BR warnquota (8)
+.PD
+.SH SEE ALSO
+.BR warnquota (8).
--
1.8.3.1

View File

@ -1,101 +0,0 @@
From d26e316c3ffd4658b25f14ea1c42384f251c96de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 13 Jun 2013 16:11:30 +0200
Subject: [PATCH] Close FILE handles on error
Functions for reading quota specification in quotaops.c create new
temporary FILE stream handle, they close it on successful return,
but they forget to close it on unsuccessful return. That leads to
memory leaks. This patch ensures that the handle gets closed in all
cases.
---
quotaops.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/quotaops.c b/quotaops.c
index 175a945..47ef9a7 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -334,42 +334,49 @@ int readprivs(struct dquot *qlist, int infd)
if (cnt != 7) {
errstr(_("Bad format:\n%s\n"), line);
+ fclose(fd);
return -1;
}
error = str2space(blocksstring, &blocks);
if (error) {
errstr(_("Bad block usage: %s: %s\n"),
blocksstring, error);
+ fclose(fd);
return -1;
}
error = str2space(bsoftstring, &bsoft);
if (error) {
errstr(_("Bad block soft limit: %s: %s\n"),
bsoftstring, error);
+ fclose(fd);
return -1;
}
error = str2space(bhardstring, &bhard);
if (error) {
errstr(_("Bad block hard limit: %s: %s\n"),
bhardstring, error);
+ fclose(fd);
return -1;
}
error = str2number(inodesstring, &inodes);
if (error) {
errstr(_("Bad inode usage: %s: %s\n"),
inodesstring, error);
+ fclose(fd);
return -1;
}
error = str2number(isoftstring, &isoft);
if (error) {
errstr(_("Bad inode soft limit: %s: %s\n"),
isoftstring, error);
+ fclose(fd);
return -1;
}
error = str2number(ihardstring, &ihard);
if (error) {
errstr(_("Bad inode hard limit: %s: %s\n"),
ihardstring, error);
+ fclose(fd);
return -1;
}
@@ -478,6 +485,7 @@ int readindividualtimes(struct dquot *qlist, int infd)
if (cnt != 3) {
format_err:
errstr(_("bad format:\n%s\n"), line);
+ fclose(fd);
return -1;
}
if (!strcmp(btimestr, _("unset")))
@@ -488,6 +496,7 @@ format_err:
if (str2timeunits(btime, bunits, &bseconds) < 0) {
units_err:
errstr(_("Bad time units. Units are 'second', 'minute', 'hour', and 'day'.\n"));
+ fclose(fd);
return -1;
}
bseconds += now;
@@ -576,11 +585,13 @@ int readtimes(struct quota_handle **handles, int infd)
cnt = sscanf(line, "%s %d %s %d %s", fsp, &btime, bunits, &itime, iunits);
if (cnt != 5) {
errstr(_("bad format:\n%s\n"), line);
+ fclose(fd);
return -1;
}
if (str2timeunits(btime, bunits, &bseconds) < 0 ||
str2timeunits(itime, iunits, &iseconds) < 0) {
errstr(_("Bad time units. Units are 'second', 'minute', 'hour', and 'day'.\n"));
+ fclose(fd);
return -1;
}
for (i = 0; handles[i]; i++) {
--
1.8.1.4

View File

@ -1,47 +0,0 @@
From 9384c1c0f8b64535595c89bb2b1a980538c8be43 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 6 Mar 2013 13:10:25 +0100
Subject: [PATCH 2/4] Complete quotasync usage
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
quotasync.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/quotasync.c b/quotasync.c
index dd8ade9..cab9015 100644
--- a/quotasync.c
+++ b/quotasync.c
@@ -22,8 +22,23 @@ char *progname;
static void usage(void)
{
- errstr(_("Utility for syncing quotas.\nUsage:\n%s [-ug] -a | mntpoint...\n\n"), progname);
- fprintf(stderr, _("Bugs to %s\n"), MY_EMAIL);
+ printf(_(
+"%1$s: Utility for syncing quotas.\n"
+"Usage: %1$s [-ug] mount-point...\n"
+" or: %1$s [-ug] -a\n"
+" or: %1$s -h | -V\n"
+"\n"
+ ), progname);
+ printf(_(
+"Options:\n"
+"-u, --user synchronize user quotas\n"
+"-g, --group synchronize group quotas\n"
+"-a, --all synchronize quotas for all mounted file systems\n"
+"-h, --help display this help message and exit\n"
+"-V, --version display version information and exit\n"
+"\n"
+ ));
+ printf(_("Report bugs to <%s>.\n"), MY_EMAIL);
exit(1);
}
--
1.8.1.4

View File

@ -1,102 +0,0 @@
From 0d5a11f41afe14f779908fbc366c492b818a0864 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 6 Mar 2013 11:32:32 +0100
Subject: [PATCH 3/4] Correct quotasync exit code
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This fixes `quotasync -h' exit code as well as it uses more portable
EXIT_SUCCESS/EXIT_FAILURE values.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
quotasync.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/quotasync.c b/quotasync.c
index cab9015..cfc3f2d 100644
--- a/quotasync.c
+++ b/quotasync.c
@@ -20,7 +20,7 @@ static char **mnt;
static int mntcnt;
char *progname;
-static void usage(void)
+static void usage(int status)
{
printf(_(
"%1$s: Utility for syncing quotas.\n"
@@ -39,7 +39,7 @@ static void usage(void)
"\n"
));
printf(_("Report bugs to <%s>.\n"), MY_EMAIL);
- exit(1);
+ exit(status);
}
static void parse_options(int argcnt, char **argstr)
@@ -57,11 +57,12 @@ static void parse_options(int argcnt, char **argstr)
while ((ret = getopt_long(argcnt, argstr, "ahugV", long_opts, NULL)) != -1) {
switch (ret) {
case '?':
+ usage(EXIT_FAILURE);
case 'h':
- usage();
+ usage(EXIT_SUCCESS);
case 'V':
version();
- exit(0);
+ exit(EXIT_SUCCESS);
case 'u':
flags |= FL_USER;
break;
@@ -77,7 +78,7 @@ static void parse_options(int argcnt, char **argstr)
if ((flags & FL_ALL && optind != argcnt) ||
(!(flags & FL_ALL) && optind == argcnt)) {
fputs(_("Bad number of arguments.\n"), stderr);
- usage();
+ usage(EXIT_FAILURE);
}
if (!(flags & FL_ALL)) {
mnt = argstr + optind;
@@ -100,10 +101,12 @@ static int syncquotas(int type)
int i, ret = 0;
if (flags & FL_ALL) {
- if (sync_one(type, NULL) < 0)
+ if (sync_one(type, NULL) < 0) {
errstr(_("%s quota sync failed: %s\n"), _(type2name(type)),
strerror(errno));
- return -1;
+ ret = -1;
+ }
+ return ret;
}
handles = create_handle_list(mntcnt, mnt, type, fmt,
@@ -124,7 +127,7 @@ static int syncquotas(int type)
int main(int argc, char **argv)
{
- int ret = 0;
+ int ret = EXIT_SUCCESS;
gettexton();
progname = basename(argv[0]);
@@ -134,9 +137,9 @@ int main(int argc, char **argv)
if (flags & FL_USER)
if (syncquotas(USRQUOTA))
- ret = 1;
+ ret = EXIT_FAILURE;
if (flags & FL_GROUP)
if (syncquotas(GRPQUOTA))
- ret = 1;
+ ret = EXIT_FAILURE;
return ret;
}
--
1.8.1.4

View File

@ -1,45 +0,0 @@
From 5f7b9d139d64117abc4dcd66d2fbac99c070d7ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 31 Jan 2013 12:58:59 +0100
Subject: [PATCH] Do not fiddle with quota files on XFS and GFS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
XFS and GFS have no quota files. Skip unnecessary examination and
rename of these files when running quotacheck.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
quotacheck.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/quotacheck.c b/quotacheck.c
index 0d0d4b2..e047825 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -828,6 +828,9 @@ static int dump_to_file(struct mount_entry *mnt, int type)
return -1;
}
debug(FL_DEBUG, _("Data dumped.\n"));
+ /* Moving of quota files doesn't apply to GFS2 or XFS */
+ if (cfmt == QF_XFS)
+ return 0;
if (kern_quota_on(mnt, type, cfmt) >= 0) { /* Quota turned on? */
char *filename;
@@ -871,6 +874,10 @@ static int sub_quota_file(struct mount_entry *mnt, int qtype, int ftype)
struct dquot *d;
qid_t id;
+ /* GFS2 and XFS do not have quota files. */
+ if (cfmt == QF_XFS)
+ return 0;
+
debug(FL_DEBUG, _("Substracting space used by old %s quota file.\n"), _(type2name(ftype)));
if (get_qf_name(mnt, ftype, cfmt, 0, &filename) < 0) {
debug(FL_VERBOSE, _("Old %s file name could not been determined. Usage will not be subtracted.\n"), _(type2name(ftype)));
--
1.8.1.2

View File

@ -1,72 +0,0 @@
From 97fad5f32bfe24b3a3ce8b3923b27099b746de06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 6 Mar 2013 13:41:23 +0100
Subject: [PATCH 4/4] Fix various usage mistakes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
quota: Fix long variant for -A option in usage
repquota: Fix long variant for -c option in usage and manual
repquota: Fix long variant for -C option in usage and manual
repquota: Add -a, --all options to usage
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
quota.c | 2 +-
repquota.8 | 4 ++--
repquota.c | 5 +++--
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/quota.c b/quota.c
index 56e71a8..1befbde 100644
--- a/quota.c
+++ b/quota.c
@@ -102,7 +102,7 @@ static void usage(void)
-i, --no-autofs do not query autofs mountpoints\n\
-F, --format=formatname display quota of a specific format\n\
-f, --filesystem-list display quota information only for given filesystems\n\
--A, --nfs-all display quota for all NFS mountpoints\n\
+-A, --all-nfs display quota for all NFS mountpoints\n\
-m, --no-mixed-pathnames trim leading slashes from NFSv4 mountpoints\n\
--show-mntpoint show mount point of the file system in output\n\
--hide-device do not show file system device in output\n\
diff --git a/repquota.8 b/repquota.8
index a71cf6b..bb6d7ab 100644
--- a/repquota.8
+++ b/repquota.8
@@ -84,11 +84,11 @@ to be read-write with quotas.
Report all quotas, even if there is no usage. Be also more verbose about quotafile
information.
.TP
-.B -c, --batch-translation
+.B -c, --cache
Cache entries to report and translate uids/gids to names in big chunks by scanning
all users (default). This is good (fast) behaviour when using /etc/passwd file.
.TP
-.B -C, --no-batch-translation
+.B -C, --no-cache
Translate individual entries. This is faster when you have users stored in database.
.TP
.B -t, --truncate-names
diff --git a/repquota.c b/repquota.c
index 43de31d..50683b9 100644
--- a/repquota.c
+++ b/repquota.c
@@ -56,9 +56,10 @@ static void usage(void)
-p, --raw-grace print grace time in seconds since epoch\n\
-n, --no-names do not translate uid/gid to name\n\
-i, --no-autofs avoid autofs mountpoints\n\
--c, --batch-translation translate big number of ids at once\n\
--C, --no-batch-translation translate ids one by one\n\
+-c, --cache translate big number of ids at once\n\
+-C, --no-cache translate ids one by one\n\
-F, --format=formatname report information for specific format\n\
+-a, --all report information for all mount points with quotas\n\
-h, --help display this help message and exit\n\
-V, --version display version information and exit\n\n"), progname);
fprintf(stderr, _("Bugs to %s\n"), MY_EMAIL);
--
1.8.1.4

View File

@ -1,241 +0,0 @@
From e4e473c7bb8f30604d763074a6d04e2854249552 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 21 Oct 2013 14:24:52 +0200
Subject: [PATCH 4/4] Improve rcp.rquota(8) manual page
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch renames rquotad(8) to rpc.rquotad(8) to reflect the
executable name. It also shows completes synopsis and documents --help option.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
rpc.rquotad.8 | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
rquotad.8 | 95 -------------------------------------------------
2 files changed, 112 insertions(+), 95 deletions(-)
create mode 100644 rpc.rquotad.8
delete mode 100644 rquotad.8
diff --git a/rpc.rquotad.8 b/rpc.rquotad.8
new file mode 100644
index 0000000..a045dba
--- /dev/null
+++ b/rpc.rquotad.8
@@ -0,0 +1,112 @@
+.TH RQUOTAD 8
+.SH NAME
+rpc.rquotad \- remote quota server
+.SH SYNOPSIS
+.B /usr/sbin/rpc.rquotad
+[
+.BR \-FI
+] [
+.B \-p
+.I port
+] [
+.B \-s
+|
+.B \-S
+] [
+.B \-x
+.I path
+]
+.LP
+.B /usr/sbin/rpc.rquotad
+[
+.B \-h
+|
+.B \-V
+]
+.SH DESCRIPTION
+.LP
+.IX "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
+.IX daemons "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
+.IX "user quotas" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
+.IX "disk quotas" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
+.IX "quotas" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
+.IX "filesystem" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
+.IX "remote procedure call services" "rquotad" "" "\fLrquotad\fP \(em remote quota server"
+.B rpc.rquotad
+is an
+.BR rpc (3)
+server which returns quotas for a user of a local filesystem
+which is mounted by a remote machine over the
+.SM NFS\s0.
+It also allows setting of quotas on
+.SM NFS
+mounted filesystem (if configured during compilation and allowed by a command line option
+.BR \-S ).
+The results are used by
+.BR quota (1)
+to display user quotas for remote filesystems and by
+.BR edquota (8)
+to set quotas on remote filesystems.
+.B rquotad
+daemon uses tcp-wrappers library (under service name
+.IR rquotad )
+which allows you to specify hosts allowed/disallowed to use
+the daemon (see
+.BR hosts.allow (5)
+manpage for more information). The
+.B rquotad
+daemon is normally started at boot time from the
+system startup scripts.
+.SH OPTIONS
+.TP
+.B \-h, \-\-help
+Show program usage and exit.
+.B \-V, \-\-version
+Show version of quota tools.
+.TP
+.B \-s, \-\-no-setquota
+Don't allow setting of quotas (default). This option is available only
+if utilities were compiled with the
+.I rpcsetquota
+option.
+.TP
+.B \-S, \-\-setquota
+Allow setting of quotas. This option is available only
+if utilities were compiled with the
+.I rpcsetquota
+option.
+.TP
+.B \-F, \-\-foreground
+Run daemon in foreground (may be useful for debugging purposes).
+.TP
+.B \-I, \-\-autofs
+Do not ignore autofs mountpoints.
+.TP
+.B \-p \f2port\f3, \-\-port \f2port\f1
+Listen on alternate port
+.IR port.
+.TP
+.B \-x \f2path\f3, \-\-xtab \f2path\f1
+Set an alternative file with NFSD export table. This file is used to
+determine pseudoroot of NFSv4 exports. The pseudoroot is then prepended
+to each relative path (i.e. a path not beginning by '/') received in a
+quota RPC request.
+
+.SH FILES
+.PD 0
+.TP 20
+.B aquota.user or aquota.group
+quota file at the filesystem root (version 2 quota, non-XFS filesystems)
+.TP
+.B quota.user or quota.group
+quota file at the filesystem root (version 1 quota, non-XFS filesystems)
+.TP
+.B /etc/mtab
+default filesystems
+.PD
+.SH "SEE ALSO"
+.BR quota (1),
+.BR rpc (3),
+.BR nfs (5),
+.BR services (5),
+.BR inetd (8)
diff --git a/rquotad.8 b/rquotad.8
deleted file mode 100644
index f18bdcc..0000000
--- a/rquotad.8
+++ /dev/null
@@ -1,95 +0,0 @@
-.TH RQUOTAD 8
-.SH NAME
-rquotad, rpc.rquotad \- remote quota server
-.SH SYNOPSIS
-.B rpc.rquotad
-[
-.B \-sSFI
-] [
-.B \-p \f2port\f1
-]
-.SH DESCRIPTION
-.LP
-.IX "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
-.IX daemons "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
-.IX "user quotas" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
-.IX "disk quotas" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
-.IX "quotas" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
-.IX "filesystem" "rquotad daemon" "" "\fLrquotad\fP \(em remote quota server"
-.IX "remote procedure call services" "rquotad" "" "\fLrquotad\fP \(em remote quota server"
-.B rquotad
-is an
-.BR rpc (3)
-server which returns quotas for a user of a local filesystem
-which is mounted by a remote machine over the
-.SM NFS\s0.
-It also allows setting of quotas on
-.SM NFS
-mounted filesystem (if configured during compilation and allowed by a command line option
-.BR \-S ).
-The results are used by
-.BR quota (1)
-to display user quotas for remote filesystems and by
-.BR edquota (8)
-to set quotas on remote filesystems.
-.B rquotad
-daemon uses tcp-wrappers library (under service name
-.IR rquotad )
-which allows you to specify hosts allowed/disallowed to use
-the daemon (see
-.BR hosts.allow (5)
-manpage for more information). The
-.B rquotad
-daemon is normally started at boot time from the
-system startup scripts.
-.SH OPTIONS
-.TP
-.B \-V, \-\-version
-Shows version of quota tools.
-.TP
-.B \-s, \-\-no-setquota
-Don't allow setting of quotas (default). This option is available only
-if utilities were compiled with the
-.I rpcsetquota
-option.
-.TP
-.B \-S, \-\-setquota
-Allow setting of quotas. This option is available only
-if utilities were compiled with the
-.I rpcsetquota
-option.
-.TP
-.B \-F, \-\-foreground
-Run daemon in foreground (may be useful for debugging purposes).
-.TP
-.B \-I, \-\-autofs
-Do not ignore autofs mountpoints.
-.TP
-.B \-p \f2port\f3, \-\-port \f2port\f1
-Listen on alternate port
-.IR port.
-.TP
-.B \-x \f2path\f3, \-\-xtab \f2path\f1
-Set an alternative file with NFSD export table. This file is used to
-determine pseudoroot of NFSv4 exports. The pseudoroot is then prepended
-to each relative path (i.e. a path not beginning by '/') received in a
-quota RPC request.
-
-.SH FILES
-.PD 0
-.TP 20
-.B aquota.user or aquota.group
-quota file at the filesystem root (version 2 quota, non-XFS filesystems)
-.TP
-.B quota.user or quota.group
-quota file at the filesystem root (version 1 quota, non-XFS filesystems)
-.TP
-.B /etc/mtab
-default filesystems
-.PD
-.SH "SEE ALSO"
-.BR quota (1),
-.BR rpc (3),
-.BR nfs (5),
-.BR services (5),
-.BR inetd (8)
--
1.8.3.1

View File

@ -1,29 +0,0 @@
From cc9476d5bf016375dc02453be424ac1ea9b01247 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 25 Sep 2012 15:27:44 +0200
Subject: [PATCH] Make group warning message more official
Port to 4.01-1.
---
warnquota.conf | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/warnquota.conf b/warnquota.conf
index 77f6a75..6d26bed 100644
--- a/warnquota.conf
+++ b/warnquota.conf
@@ -27,8 +27,9 @@ MESSAGE = Your disk usage has exceeded the agreed limits\
# is created)
SIGNATURE = root@example.com
# Following text is used for mails about group exceeding quotas
-GROUP_MESSAGE = Hello, a group '%i' you're member of use too much space at %h.|\
-I chose you to do the cleanup.|Delete group files on the following filesystems:|
+GROUP_MESSAGE = Hello,|\
+your group %i is using too much disk space at %h.|\
+I suggest you to clean up group files on the following filesystems:|
# Text in the end of the mail to the group (if not specified, default text using SUPPORT
# and PHONE is created).
GROUP_SIGNATURE = See you!| Your admin|
--
1.7.11.4

View File

@ -1,167 +0,0 @@
From 6842c7cff2542af8e1c693f3bc6c52b1b2e87caa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Mon, 24 Feb 2014 15:54:32 +0100
Subject: [PATCH] Prevent from grace period overflow in RPC transport
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The RPC transports grace time as unsigned int, but the value stored
there and retrivedd from is treated as singed difference against current time.
This leads to overflow after expiring the grace time which is
presented as an enourmously large grace time instead of "none" in the
quota(1) output.
There also possible an overflow when the time difference is still
bigger than an int can represent.
This first issue is solved by explicit type cast to/from int32_t, the
second issue is fixes by limiting the value into int32_t range.
<https://sourceforge.net/p/linuxquota/bugs/115/>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotasys.c | 13 +++++++++++++
quotasys.h | 4 ++++
rquota_client.c | 9 +++++----
rquota_server.c | 9 +++++----
4 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/quotasys.c b/quotasys.c
index dee5118..b52c1d2 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -23,6 +23,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/vfs.h>
+#include <stdint.h>
#include "pot.h"
#include "bylabel.h"
@@ -323,6 +324,18 @@ void difftime2str(time_t seconds, char *buf)
}
/*
+ * Round difference of two time_t values into int32_t
+ */
+int32_t difftime2net(time_t later, time_t sooner)
+{
+ if ((later - sooner) > INT32_MAX)
+ return INT32_MAX;
+ if ((later - sooner) < INT32_MIN)
+ return INT32_MIN;
+ return (later - sooner);
+}
+
+/*
* Convert time to printable form
*/
void time2str(time_t seconds, char *buf, int flags)
diff --git a/quotasys.h b/quotasys.h
index 5ca26e6..7877cdd 100644
--- a/quotasys.h
+++ b/quotasys.h
@@ -8,6 +8,7 @@
#define GUARD_QUOTASYS_H
#include <sys/types.h>
+#include <inttypes.h>
#include "mntopt.h"
#include "quota.h"
@@ -100,6 +101,9 @@ int util2kernfmt(int fmt);
/* Convert time difference between given time and current time to printable form */
void difftime2str(time_t, char *);
+/* Round difference of two time_t values into int32_t */
+int32_t difftime2net(time_t later, time_t sooner);
+
/* Convert time to printable form */
void time2str(time_t, char *, int);
diff --git a/rquota_client.c b/rquota_client.c
index e26e066..00adae2 100644
--- a/rquota_client.c
+++ b/rquota_client.c
@@ -32,6 +32,7 @@
#include <string.h>
#include <signal.h>
#include <time.h>
+#include <stdint.h>
#include "mntopt.h"
#include "rquota.h"
@@ -54,11 +55,11 @@ static inline void clinet2utildqblk(struct util_dqblk *u, struct rquota *n)
u->dqb_curspace = ((qsize_t)n->rq_curblocks) * n->rq_bsize;
time(&now);
if (n->rq_btimeleft)
- u->dqb_btime = n->rq_btimeleft + now;
+ u->dqb_btime = (int32_t)n->rq_btimeleft + now;
else
u->dqb_btime = 0;
if (n->rq_ftimeleft)
- u->dqb_itime = n->rq_ftimeleft + now;
+ u->dqb_itime = (int32_t)n->rq_ftimeleft + now;
else
u->dqb_itime = 0;
}
@@ -76,11 +77,11 @@ static inline void cliutil2netdqblk(struct sq_dqblk *n, struct util_dqblk *u)
n->rq_curblocks = toqb(u->dqb_curspace);
n->rq_curfiles = u->dqb_curinodes;
if (u->dqb_btime)
- n->rq_btimeleft = u->dqb_btime - now;
+ n->rq_btimeleft = difftime2net(u->dqb_btime, now);
else
n->rq_btimeleft = 0;
if (u->dqb_itime)
- n->rq_ftimeleft = u->dqb_itime - now;
+ n->rq_ftimeleft = difftime2net(u->dqb_itime, now);
else
n->rq_ftimeleft = 0;
}
diff --git a/rquota_server.c b/rquota_server.c
index bf66e4d..09cf6ed 100644
--- a/rquota_server.c
+++ b/rquota_server.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <syslog.h>
#include <time.h>
+#include <stdint.h>
#include "mntopt.h"
#include "quotaops.h"
@@ -82,11 +83,11 @@ static inline void servnet2utildqblk(struct util_dqblk *u, sq_dqblk * n)
u->dqb_curspace = ((qsize_t)n->rq_curblocks) << RPC_DQBLK_SIZE_BITS;
u->dqb_curinodes = n->rq_curfiles;
if (n->rq_btimeleft)
- u->dqb_btime = n->rq_btimeleft + now;
+ u->dqb_btime = (int32_t)n->rq_btimeleft + now;
else
u->dqb_btime = 0;
if (n->rq_ftimeleft)
- u->dqb_itime = n->rq_ftimeleft + now;
+ u->dqb_itime = (int32_t)n->rq_ftimeleft + now;
else
u->dqb_itime = 0;
}
@@ -127,11 +128,11 @@ static inline void servutil2netdqblk(struct rquota *n, struct util_dqblk *u)
time(&now);
if (u->dqb_btime)
- n->rq_btimeleft = u->dqb_btime - now;
+ n->rq_btimeleft = difftime2net(u->dqb_btime, now);
else
n->rq_btimeleft = 0;
if (u->dqb_itime)
- n->rq_ftimeleft = u->dqb_itime - now;
+ n->rq_ftimeleft = difftime2net(u->dqb_itime, now);
else
n->rq_ftimeleft = 0;
}
--
1.8.5.3

View File

@ -1,74 +0,0 @@
From 2d851a9726b799078f8c2279d8dd9ce39b7b4055 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 9 Jan 2013 17:27:11 +0100
Subject: [PATCH 2/5] Recognize block limit units on setquota standard input
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch adds support for binary suffixes on `setquota -b' input.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
setquota.c | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
diff --git a/setquota.c b/setquota.c
index ccac7f7..e55b79d 100644
--- a/setquota.c
+++ b/setquota.c
@@ -319,7 +319,9 @@ static int read_entry(qid_t *id, qsize_t *isoftlimit, qsize_t *ihardlimit, qsize
static int line = 0;
char name[MAXNAMELEN+1];
char linebuf[MAXLINELEN], *chptr;
- unsigned long is, ih, bs, bh;
+ unsigned long is, ih;
+ char bs[MAXNAMELEN+1], bh[MAXNAMELEN+1];
+ const char *error;
int ret;
while (1) {
@@ -337,7 +339,7 @@ static int read_entry(qid_t *id, qsize_t *isoftlimit, qsize_t *ihardlimit, qsize
chptr++;
if (*chptr == '\n')
continue;
- ret = sscanf(chptr, "%s %lu %lu %lu %lu", name, &bs, &bh, &is, &ih);
+ ret = sscanf(chptr, "%s %s %s %lu %lu", name, bs, bh, &is, &ih);
if (ret != 5) {
errstr(_("Cannot parse input line %d.\n"), line);
if (!(flags & FL_CONTINUE_BATCH))
@@ -353,12 +355,28 @@ static int read_entry(qid_t *id, qsize_t *isoftlimit, qsize_t *ihardlimit, qsize
errstr(_("Skipping line.\n"));
continue;
}
+ error = str2space(bs, bsoftlimit);
+ if (error) {
+ errstr(_("Unable to parse block soft limit '%s' "
+ "on line %d: %s\n"), bs, line, error);
+ if (!(flags & FL_CONTINUE_BATCH))
+ die(1, _("Exitting.\n"));
+ errstr(_("Skipping line.\n"));
+ continue;
+ }
+ error = str2space(bh, bhardlimit);
+ if (error) {
+ errstr(_("Unable to parse block hard limit '%s' "
+ "on line %d: %s\n"), bh, line, error);
+ if (!(flags & FL_CONTINUE_BATCH))
+ die(1, _("Exitting.\n"));
+ errstr(_("Skipping line.\n"));
+ continue;
+ }
break;
}
*isoftlimit = is;
*ihardlimit = ih;
- *bsoftlimit = bs;
- *bhardlimit = bh;
return 0;
}
--
1.8.1.4

View File

@ -1,89 +0,0 @@
From f61d6442cc92a2b2935db6995b8d901235dbd076 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 9 Jan 2013 18:16:14 +0100
Subject: [PATCH 3/5] Recognize units at block limits by edquota
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
With this patch, it's possible to specify block values including
binary units in the editor run by edquota.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
edquota.8 | 4 ++++
quotaops.c | 28 +++++++++++++++++++++++++---
2 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/edquota.8 b/edquota.8
index 4b1406b..2617068 100644
--- a/edquota.8
+++ b/edquota.8
@@ -64,6 +64,10 @@ is then invoked on the file. The quotas may then be modified, new
quotas added, etc.
Setting a quota to zero indicates that no quota should be imposed.
.PP
+Block usage and limits are reported and interpereted as multiples of kibibyte
+(1024 bytes) blocks by default. Symbols K, M, G, and T can be appended to
+numeric value to express kibibytes, mebibytes, gibibytes, and tebibytes.
+.PP
Users are permitted to exceed their soft limits for a grace period that
may be specified per filesystem. Once the grace period has expired, the
soft limit is enforced as a hard limit.
diff --git a/quotaops.c b/quotaops.c
index 1416015..32e21da 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -310,9 +310,12 @@ int readprivs(struct dquot *qlist, int infd)
{
FILE *fd;
int cnt;
- long long blocks, bsoft, bhard, inodes, isoft, ihard;
+ qsize_t blocks, bsoft, bhard;
+ long long inodes, isoft, ihard;
struct dquot *q;
char fsp[BUFSIZ], line[BUFSIZ];
+ char blocksstring[BUFSIZ], bsoftstring[BUFSIZ], bhardstring[BUFSIZ];
+ const char *error;
lseek(infd, 0, SEEK_SET);
if (!(fd = fdopen(dup(infd), "r")))
@@ -325,13 +328,32 @@ int readprivs(struct dquot *qlist, int infd)
fgets(line, sizeof(line), fd);
while (fgets(line, sizeof(line), fd)) {
- cnt = sscanf(line, "%s %llu %llu %llu %llu %llu %llu",
- fsp, &blocks, &bsoft, &bhard, &inodes, &isoft, &ihard);
+ cnt = sscanf(line, "%s %s %s %s %llu %llu %llu",
+ fsp, blocksstring, bsoftstring, bhardstring,
+ &inodes, &isoft, &ihard);
if (cnt != 7) {
errstr(_("Bad format:\n%s\n"), line);
return -1;
}
+ error = str2space(blocksstring, &blocks);
+ if (error) {
+ errstr(_("Bad block usage: %s: %s\n"),
+ blocksstring, error);
+ return -1;
+ }
+ error = str2space(bsoftstring, &bsoft);
+ if (error) {
+ errstr(_("Bad block soft limit: %s: %s\n"),
+ bsoftstring, error);
+ return -1;
+ }
+ error = str2space(bhardstring, &bhard);
+ if (error) {
+ errstr(_("Bad block hard limit: %s: %s\n"),
+ bhardstring, error);
+ return -1;
+ }
merge_limits_to_list(qlist, fsp, blocks, bsoft, bhard, inodes, isoft, ihard);
}
--
1.8.1.4

View File

@ -1,151 +0,0 @@
From 0ada9c13f9b8299ff607b66c37022ce2a3c4444b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 9 Jan 2013 17:00:44 +0100
Subject: [PATCH 1/5] Recognize units at block limits by setquota
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch allows to specify suffixes at block limits on setquota
command line. Binary units K, M, G, T are implemented. Numeric value
without suffix is equivatent to kibibytes as before. This is
complementary functionality to `quota -s'.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
quota.h | 2 ++
quotasys.c | 31 +++++++++++++++++++++++++++++++
quotasys.h | 3 +++
setquota.8 | 7 +++++++
setquota.c | 17 +++++++++++++++--
5 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/quota.h b/quota.h
index ac034d0..6787eab 100644
--- a/quota.h
+++ b/quota.h
@@ -2,9 +2,11 @@
#define GUARD_QUOTA_H
#include <sys/types.h>
+#include <stdint.h>
typedef u_int32_t qid_t; /* Type in which we store ids in memory */
typedef int64_t qsize_t; /* Type in which we store size limitations */
+#define QSIZE_MAX INT64_MAX /* Maximum value storable in qsize_t */
#define MAXQUOTAS 2
#define USRQUOTA 0 /* element used for user quotas */
diff --git a/quotasys.c b/quotasys.c
index 03f678a..5c1464f 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -367,6 +367,37 @@ void space2str(qsize_t space, char *buf, int format)
}
/*
+ * Convert block number with unit from string to quota blocks.
+ * Return NULL on success, static error message otherwise.
+ */
+const char *str2space(const char *string, qsize_t *space)
+{
+ char *unit;
+ unsigned long long int number;
+ int unit_shift;
+
+ number = strtoull(string, &unit, 0);
+ if (ULLONG_MAX == number)
+ return _("Integer overflow while parsing space number.");
+
+ if (!unit || unit[0] == '\0' || !strcmp(unit, _("K")))
+ unit_shift = 0;
+ else if (!strcmp(unit, _("M")))
+ unit_shift = 10;
+ else if (!strcmp(unit, _("G")))
+ unit_shift = 20;
+ else if (!strcmp(unit, _("T")))
+ unit_shift = 30;
+ else
+ return _("Unknown space binary unit. "
+ "Valid units are K, M, G, T.");
+ if (number > (QSIZE_MAX >> unit_shift))
+ return _("Integer overflow while interpreting space unit.");
+ *space = number << unit_shift;
+ return NULL;
+}
+
+/*
* Convert number to some nice short form for printing
*/
void number2str(unsigned long long num, char *buf, int format)
diff --git a/quotasys.h b/quotasys.h
index 1cebf7e..0cc2c4c 100644
--- a/quotasys.h
+++ b/quotasys.h
@@ -103,6 +103,9 @@ int str2timeunits(time_t, char *, time_t *);
/* Convert number in quota blocks to short printable form */
void space2str(qsize_t, char *, int);
+/* Convert block number with unit from string to quota blocks */
+const char *str2space(const char *string, qsize_t *space);
+
/* Convert number to short printable form */
void number2str(unsigned long long, char *, int);
diff --git a/setquota.8 b/setquota.8
index db9d054..e4511c4 100644
--- a/setquota.8
+++ b/setquota.8
@@ -182,6 +182,13 @@ Go through all filesystems with quota in
.B /etc/mtab
and perform setting.
.PP
+.I block-softlimit
+and
+.I block-hardlimit
+are interpreted as multiples of kibibyte (1024 bytes) blocks by default.
+Symbols K, M, G, and T can be appended to numeric value to express kibibytes,
+mebibytes, gibibytes, and tebibytes.
+.PP
To disable a quota, set the corresponding parameter to 0. To change quotas
for several filesystems, invoke once for each filesystem.
.PP
diff --git a/setquota.c b/setquota.c
index f609dc7..ccac7f7 100644
--- a/setquota.c
+++ b/setquota.c
@@ -93,6 +93,19 @@ static qsize_t parse_unum(char *str, char *msg)
return ret;
}
+/* Convert block size to number - print errstr message in case of failure */
+static qsize_t parse_blocksize(const char *str, const char *msg)
+{
+ qsize_t ret;
+ const char *error = str2space(str, &ret);
+
+ if (error) {
+ errstr(_("%s: %s: %s\n"), msg, str, error);
+ usage();
+ }
+ return ret;
+}
+
/* Convert our flags to quota type */
static inline int flag2type(int flags)
{
@@ -226,8 +239,8 @@ static void parse_options(int argcnt, char **argstr)
if (!(flags & (FL_GRACE | FL_BATCH))) {
id = name2id(argstr[optind++], flag2type(flags), !!(flags & FL_NUMNAMES), NULL);
if (!(flags & (FL_GRACE | FL_INDIVIDUAL_GRACE | FL_PROTO))) {
- toset.dqb_bsoftlimit = parse_unum(argstr[optind++], _("Bad block softlimit"));
- toset.dqb_bhardlimit = parse_unum(argstr[optind++], _("Bad block hardlimit"));
+ toset.dqb_bsoftlimit = parse_blocksize(argstr[optind++], _("Bad block softlimit"));
+ toset.dqb_bhardlimit = parse_blocksize(argstr[optind++], _("Bad block hardlimit"));
toset.dqb_isoftlimit = parse_unum(argstr[optind++], _("Bad inode softlimit"));
toset.dqb_ihardlimit = parse_unum(argstr[optind++], _("Bad inode hardlimit"));
}
--
1.8.1.4

View File

@ -1,105 +0,0 @@
From 73316c7746e89896c63fc49f24cafe32335df288 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 9 Jan 2013 18:16:14 +0100
Subject: [PATCH 5/5] Recognize units at inode limits by edquota
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
With this patch, it's possible to specify inode values including
decimal units in the editor run by edquota.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
edquota.8 | 4 ++++
quotaops.c | 26 ++++++++++++++++++++++----
setquota.c | 2 --
3 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/edquota.8 b/edquota.8
index 2617068..fefb5d4 100644
--- a/edquota.8
+++ b/edquota.8
@@ -68,6 +68,10 @@ Block usage and limits are reported and interpereted as multiples of kibibyte
(1024 bytes) blocks by default. Symbols K, M, G, and T can be appended to
numeric value to express kibibytes, mebibytes, gibibytes, and tebibytes.
.PP
+Inode usage and limits are interpreted literally. Symbols k, m, g, and t can
+be appended to numeric value to express multiples of 10^3, 10^6, 10^9, and
+10^12 inodes.
+.PP
Users are permitted to exceed their soft limits for a grace period that
may be specified per filesystem. Once the grace period has expired, the
soft limit is enforced as a hard limit.
diff --git a/quotaops.c b/quotaops.c
index 32e21da..175a945 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -310,11 +310,11 @@ int readprivs(struct dquot *qlist, int infd)
{
FILE *fd;
int cnt;
- qsize_t blocks, bsoft, bhard;
- long long inodes, isoft, ihard;
+ qsize_t blocks, bsoft, bhard, inodes, isoft, ihard;
struct dquot *q;
char fsp[BUFSIZ], line[BUFSIZ];
char blocksstring[BUFSIZ], bsoftstring[BUFSIZ], bhardstring[BUFSIZ];
+ char inodesstring[BUFSIZ], isoftstring[BUFSIZ], ihardstring[BUFSIZ];
const char *error;
lseek(infd, 0, SEEK_SET);
@@ -328,9 +328,9 @@ int readprivs(struct dquot *qlist, int infd)
fgets(line, sizeof(line), fd);
while (fgets(line, sizeof(line), fd)) {
- cnt = sscanf(line, "%s %s %s %s %llu %llu %llu",
+ cnt = sscanf(line, "%s %s %s %s %s %s %s",
fsp, blocksstring, bsoftstring, bhardstring,
- &inodes, &isoft, &ihard);
+ inodesstring, isoftstring, ihardstring);
if (cnt != 7) {
errstr(_("Bad format:\n%s\n"), line);
@@ -354,6 +354,24 @@ int readprivs(struct dquot *qlist, int infd)
bhardstring, error);
return -1;
}
+ error = str2number(inodesstring, &inodes);
+ if (error) {
+ errstr(_("Bad inode usage: %s: %s\n"),
+ inodesstring, error);
+ return -1;
+ }
+ error = str2number(isoftstring, &isoft);
+ if (error) {
+ errstr(_("Bad inode soft limit: %s: %s\n"),
+ isoftstring, error);
+ return -1;
+ }
+ error = str2number(ihardstring, &ihard);
+ if (error) {
+ errstr(_("Bad inode hard limit: %s: %s\n"),
+ ihardstring, error);
+ return -1;
+ }
merge_limits_to_list(qlist, fsp, blocks, bsoft, bhard, inodes, isoft, ihard);
}
diff --git a/setquota.c b/setquota.c
index 19449ad..cc5fee8 100644
--- a/setquota.c
+++ b/setquota.c
@@ -406,8 +406,6 @@ static int read_entry(qid_t *id, qsize_t *isoftlimit, qsize_t *ihardlimit, qsize
}
break;
}
- *isoftlimit = is;
- *ihardlimit = ih;
return 0;
}
--
1.8.1.4

View File

@ -1,177 +0,0 @@
From fdcf21db852bc8d6c1d0b41f2812ba614851e2b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 9 Jan 2013 17:00:44 +0100
Subject: [PATCH 4/5] Recognize units at inode limits by setquota
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This patch allows to specify suffixes at inode limits on setquota
command line and standard input. Decimal Units k, m, g, t are
implemented. Numeric value without suffix is equivatent to single
inodes as before. This is complementary functionality to `quota -s'.
Signed-off-by: Petr Písař <ppisar@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
quotasys.c | 32 ++++++++++++++++++++++++++++++++
quotasys.h | 3 +++
setquota.8 | 6 ++++++
setquota.c | 39 +++++++++++++++++++++++++++++++++++----
4 files changed, 76 insertions(+), 4 deletions(-)
diff --git a/quotasys.c b/quotasys.c
index 5c1464f..e583437 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -416,6 +416,38 @@ void number2str(unsigned long long num, char *buf, int format)
}
/*
+ * Convert inode number with unit from string to quota inodes.
+ * Return NULL on success, static error message otherwise.
+ */
+const char *str2number(const char *string, qsize_t *inodes)
+{
+ char *unit;
+ unsigned long long int number, multiple;
+
+ number = strtoull(string, &unit, 0);
+ if (ULLONG_MAX == number)
+ return _("Integer overflow while parsing number.");
+
+ if (!unit || unit[0] == '\0')
+ multiple = 1;
+ else if (!strcmp(unit, _("k")))
+ multiple = 1000;
+ else if (!strcmp(unit, _("m")))
+ multiple = 1000000;
+ else if (!strcmp(unit, _("g")))
+ multiple = 1000000000;
+ else if (!strcmp(unit, _("t")))
+ multiple = 1000000000000ULL;
+ else
+ return _("Unknown decimal unit. "
+ "Valid units are k, m, g, t.");
+ if (number > QSIZE_MAX / multiple)
+ return _("Integer overflow while interpreting decimal unit.");
+ *inodes = number * multiple;
+ return NULL;
+}
+
+/*
* Wrappers for mount options processing functions
*/
diff --git a/quotasys.h b/quotasys.h
index 0cc2c4c..505ea77 100644
--- a/quotasys.h
+++ b/quotasys.h
@@ -109,6 +109,9 @@ const char *str2space(const char *string, qsize_t *space);
/* Convert number to short printable form */
void number2str(unsigned long long, char *, int);
+/* Convert inode number with unit from string to quota inodes. */
+const char *str2number(const char *string, qsize_t *inodes);
+
/* Return pointer to given mount option in mount option string */
char *str_hasmntopt(const char *optstring, const char *opt);
diff --git a/setquota.8 b/setquota.8
index e4511c4..508309e 100644
--- a/setquota.8
+++ b/setquota.8
@@ -189,6 +189,12 @@ are interpreted as multiples of kibibyte (1024 bytes) blocks by default.
Symbols K, M, G, and T can be appended to numeric value to express kibibytes,
mebibytes, gibibytes, and tebibytes.
.PP
+.I inode-softlimit
+and
+.I inode-hardlimit
+are interpreted literally. Symbols k, m, g, and t can be appended to numeric
+value to express multiples of 10^3, 10^6, 10^9, and 10^12 inodes.
+.PP
To disable a quota, set the corresponding parameter to 0. To change quotas
for several filesystems, invoke once for each filesystem.
.PP
diff --git a/setquota.c b/setquota.c
index e55b79d..19449ad 100644
--- a/setquota.c
+++ b/setquota.c
@@ -106,6 +106,19 @@ static qsize_t parse_blocksize(const char *str, const char *msg)
return ret;
}
+/* Convert inode count to number - print errstr message in case of failure */
+static qsize_t parse_inodecount(const char *str, const char *msg)
+{
+ qsize_t ret;
+ const char *error = str2number(str, &ret);
+
+ if (error) {
+ errstr(_("%s: %s: %s\n"), msg, str, error);
+ usage();
+ }
+ return ret;
+}
+
/* Convert our flags to quota type */
static inline int flag2type(int flags)
{
@@ -241,8 +254,8 @@ static void parse_options(int argcnt, char **argstr)
if (!(flags & (FL_GRACE | FL_INDIVIDUAL_GRACE | FL_PROTO))) {
toset.dqb_bsoftlimit = parse_blocksize(argstr[optind++], _("Bad block softlimit"));
toset.dqb_bhardlimit = parse_blocksize(argstr[optind++], _("Bad block hardlimit"));
- toset.dqb_isoftlimit = parse_unum(argstr[optind++], _("Bad inode softlimit"));
- toset.dqb_ihardlimit = parse_unum(argstr[optind++], _("Bad inode hardlimit"));
+ toset.dqb_isoftlimit = parse_inodecount(argstr[optind++], _("Bad inode softlimit"));
+ toset.dqb_ihardlimit = parse_inodecount(argstr[optind++], _("Bad inode hardlimit"));
}
else if (flags & FL_PROTO)
protoid = name2id(protoname, flag2type(flags), !!(flags & FL_NUMNAMES), NULL);
@@ -319,7 +332,7 @@ static int read_entry(qid_t *id, qsize_t *isoftlimit, qsize_t *ihardlimit, qsize
static int line = 0;
char name[MAXNAMELEN+1];
char linebuf[MAXLINELEN], *chptr;
- unsigned long is, ih;
+ char is[MAXNAMELEN+1], ih[MAXNAMELEN+1];
char bs[MAXNAMELEN+1], bh[MAXNAMELEN+1];
const char *error;
int ret;
@@ -339,7 +352,7 @@ static int read_entry(qid_t *id, qsize_t *isoftlimit, qsize_t *ihardlimit, qsize
chptr++;
if (*chptr == '\n')
continue;
- ret = sscanf(chptr, "%s %s %s %lu %lu", name, bs, bh, &is, &ih);
+ ret = sscanf(chptr, "%s %s %s %s %s", name, bs, bh, is, ih);
if (ret != 5) {
errstr(_("Cannot parse input line %d.\n"), line);
if (!(flags & FL_CONTINUE_BATCH))
@@ -373,6 +386,24 @@ static int read_entry(qid_t *id, qsize_t *isoftlimit, qsize_t *ihardlimit, qsize
errstr(_("Skipping line.\n"));
continue;
}
+ error = str2number(is, isoftlimit);
+ if (error) {
+ errstr(_("Unable to parse inode soft limit '%s' "
+ "on line %d: %s\n"), is, line, error);
+ if (!(flags & FL_CONTINUE_BATCH))
+ die(1, _("Exitting.\n"));
+ errstr(_("Skipping line.\n"));
+ continue;
+ }
+ error = str2number(ih, ihardlimit);
+ if (error) {
+ errstr(_("Unable to parse inode hard limit '%s' "
+ "on line %d: %s\n"), ih, line, error);
+ if (!(flags & FL_CONTINUE_BATCH))
+ die(1, _("Exitting.\n"));
+ errstr(_("Skipping line.\n"));
+ continue;
+ }
break;
}
*isoftlimit = is;
--
1.8.1.4

View File

@ -1,41 +0,0 @@
From 246dd4960e6878f3ff2e1fe34ef978bcb21e8d03 Mon Sep 17 00:00:00 2001
From: Carsten Grohmann <cgrohmann@users.sf.net>
Date: Wed, 14 Aug 2013 18:16:46 +0200
Subject: [PATCH] Remove installation of manpages into section 2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There are no manpages in this section in quota tools anymore. So just
remove the installation commands.
Signed-off-by: Carsten Grohmann <cgrohmann@users.sf.net>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
Makefile.in | 2 --
1 file changed, 2 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index c81d7a9..84fafce 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -89,7 +89,6 @@ install: all @INSTMO@
-$(INSTALL) -m $(DEF_CONF_MODE) quotatab $(ROOTDIR)$(sysconfdir)
-$(INSTALL) -m $(DEF_CONF_MODE) quotagrpadmins $(ROOTDIR)$(sysconfdir)
-mkdir -p $(ROOTDIR)$(mandir)/man1
- -mkdir -p $(ROOTDIR)$(mandir)/man2
-mkdir -p $(ROOTDIR)$(mandir)/man3
-mkdir -p $(ROOTDIR)$(mandir)/man8
-$(INSTALL) -m 755 -d $(ROOTDIR)$(includedir)/rpcsvc
@@ -100,7 +99,6 @@ ifneq ($(NETLINKLIBS),)
-$(INSTALL) $(STRIP) -m $(DEF_SBIN_MODE) quota_nld $(ROOTDIR)$(sbindir)
endif
-$(INSTALL) -m $(DEF_MAN_MODE) *.1 $(ROOTDIR)$(mandir)/man1
- -$(INSTALL) -m $(DEF_MAN_MODE) *.2 $(ROOTDIR)$(mandir)/man2
-$(INSTALL) -m $(DEF_MAN_MODE) *.3 $(ROOTDIR)$(mandir)/man3
-$(INSTALL) -m $(DEF_MAN_MODE) *.8 $(ROOTDIR)$(mandir)/man8
--
1.8.3.1

View File

@ -1,79 +0,0 @@
From aebb8189069f24e6f4e59cf79f179bcbafe7a098 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 6 Nov 2012 11:04:44 +0100
Subject: [PATCH 1/2] warnquota: Add MIME-Version header
Warnquota forgot to add MIME-Version header to sent email when Content-type
etc. fields were set.
Signed-off-by: Jan Kara <jack@suse.cz>
---
warnquota.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/warnquota.c b/warnquota.c
index 08827f2..80f528c 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -503,6 +503,7 @@ static int mail_user(struct offenderlist *offender, struct configparams *config)
if (should_cc(offender, config))
fprintf(fp, "Cc: %s\n", config->cc_to);
if ((config->charset)[0] != '\0') { /* are we supposed to set the encoding */
+ fprintf(fp, "MIME-Version: 1.0\n");
fprintf(fp, "Content-Type: text/plain; charset=%s\n", config->charset);
fprintf(fp, "Content-Disposition: inline\n");
fprintf(fp, "Content-Transfer-Encoding: 8bit\n");
--
1.7.11.7
From d8bb9ec3cef26cd3fb62534d896bf9c8feea67f9 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 6 Nov 2012 12:12:19 +0100
Subject: [PATCH 2/2] warnquota: Use current locale as default charset
If charset in warnquota.conf is not specified, use charset from current
locale as the charset of the warning email. This is to accomodate possible
translations of messages via gettext.
Signed-off-by: Jan Kara <jack@suse.cz>
---
warnquota.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/warnquota.c b/warnquota.c
index 80f528c..5c5a1b9 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -29,6 +29,8 @@
#include <grp.h>
#include <time.h>
#include <getopt.h>
+#include <locale.h>
+#include <langinfo.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/utsname.h>
@@ -707,6 +709,7 @@ static int readconfigfile(const char *filename, struct configparams *config)
char *value;
char *pos;
int line, len, bufpos;
+ char *locale;
/* set default values */
sstrncpy(config->mail_cmd, MAIL_CMD, CNF_BUFFER);
@@ -716,6 +719,12 @@ static int readconfigfile(const char *filename, struct configparams *config)
sstrncpy(config->support, SUPPORT, CNF_BUFFER);
sstrncpy(config->phone, PHONE, CNF_BUFFER);
(config->charset)[0] = '\0';
+ setlocale(LC_ALL, NULL);
+ locale = setlocale(LC_MESSAGES, NULL);
+ if (locale && strcasecmp(locale, "posix") && strcasecmp(locale, "c")) {
+ locale = nl_langinfo(CODESET);
+ sstrncpy(config->charset, locale, CNF_BUFFER);
+ }
maildev[0] = 0;
config->user_signature = config->user_message = config->group_signature = config->group_message = NULL;
config->use_ldap_mail = 0;
--
1.7.11.7

View File

@ -1,63 +0,0 @@
From 8985a04067eb396877593db102d4a535c8a2871a Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 4 Feb 2013 23:21:30 +0100
Subject: [PATCH] quotacheck: Make sure -d provides at least as much
information as -v
There was a couple of useful messages that were printed when -v was
specified but not when -d was specified. Fix this.
Signed-off-by: Jan Kara <jack@suse.cz>
---
quotacheck.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/quotacheck.c b/quotacheck.c
index e047825..e62c3a7 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -880,12 +880,12 @@ static int sub_quota_file(struct mount_entry *mnt, int qtype, int ftype)
debug(FL_DEBUG, _("Substracting space used by old %s quota file.\n"), _(type2name(ftype)));
if (get_qf_name(mnt, ftype, cfmt, 0, &filename) < 0) {
- debug(FL_VERBOSE, _("Old %s file name could not been determined. Usage will not be subtracted.\n"), _(type2name(ftype)));
+ debug(FL_VERBOSE | FL_DEBUG, _("Old %s file name could not been determined. Usage will not be subtracted.\n"), _(type2name(ftype)));
return 0;
}
if (stat(filename, &st) < 0) {
- debug(FL_VERBOSE, _("Cannot stat old %s quota file %s: %s. Usage will not be subtracted.\n"), _(type2name(ftype)), filename, strerror(errno));
+ debug(FL_VERBOSE | FL_DEBUG, _("Cannot stat old %s quota file %s: %s. Usage will not be subtracted.\n"), _(type2name(ftype)), filename, strerror(errno));
free(filename);
return 0;
}
@@ -961,7 +961,7 @@ Please stop all programs writing to filesystem or use -m flag to force checking.
debug(FL_DEBUG, _("Filesystem remounted read-only\n"));
}
start_scan:
- debug(FL_VERBOSE, _("Scanning %s [%s] "), mnt->me_devname, mnt->me_dir);
+ debug(FL_VERBOSE | FL_DEBUG, _("Scanning %s [%s] "), mnt->me_devname, mnt->me_dir);
#if defined(EXT2_DIRECT)
if (!strcmp(mnt->me_type, MNTTYPE_EXT2) || !strcmp(mnt->me_type, MNTTYPE_EXT3) || !strcmp(mnt->me_type, MNTTYPE_NEXT3)) {
if ((failed = ext2_direct_scan(mnt->me_devname)) < 0)
@@ -977,7 +977,7 @@ start_scan:
goto out;
}
dirs_done++;
- if (flags & FL_VERBOSE || flags & FL_VERYVERBOSE)
+ if (flags & FL_VERBOSE || flags & FL_DEBUG)
fputs(_("done\n"), stdout);
if (ucheck) {
failed |= sub_quota_file(mnt, USRQUOTA, USRQUOTA);
@@ -1171,7 +1171,7 @@ static int check_all(void)
debug(FL_DEBUG, _("Detected quota format %s\n"), fmt2name(cfmt));
}
- if (flags & FL_VERBOSE &&
+ if (flags & (FL_VERBOSE | FL_DEBUG) &&
!str_hasmntopt(mnt->me_opts, MNTOPT_USRJQUOTA) &&
!str_hasmntopt(mnt->me_opts, MNTOPT_GRPJQUOTA) &&
!warned &&
--
1.8.1.2

View File

@ -0,0 +1,49 @@
From f9e56db59fde6e6eccd4c51c5c158ce4eed3b922 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Wed, 26 Nov 2014 13:00:18 +0100
Subject: [PATCH] Build rpc.rquotad as PIE
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
Makefile.in | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Makefile.in b/Makefile.in
index 7d25930..25f1203 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -48,6 +48,9 @@ LIBOBJS += @LIBMALLOC@
all: $(PROGS)
+svc_socket.o rquota_server.o rquota_svc.o $(filter-out rquota_xdr.o,$(LIBOBJS)): %.o: %.c
+ $(CC) $(CFLAGS) -fpie -c $<
+
clean:
-rm -f core *.o .*.d
@@ -141,7 +144,8 @@ convertquota: convertquota.o $(LIBOBJS)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^
rpc.rquotad: rquota_server.o rquota_svc.o svc_socket.o $(LIBOBJS)
- $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
+ $(CC) $(CFLAGS) -pie $(LDFLAGS) -o $@ $^ $(LIBS)
+ @if readelf -d $@|fgrep -q TEXTREL; then echo "*** Text relocation"; false; else true; fi
ifneq ($(NETLINKLIBS),)
quota_nld: quota_nld.o $(LIBOBJS)
@@ -157,7 +161,7 @@ rquota_xdr.c: rquota.x
$(RPCGEN) -c -o $@ $<
rquota_xdr.o: rquota_xdr.c rquota.h
- $(CC) $(CFLAGS) -Wno-unused -c $<
+ $(CC) $(CFLAGS) -Wno-unused -fpie -c $<
rquota_clnt.c: rquota.x
$(RPCGEN) -l -o $@ $<
--
1.9.3

View File

@ -1,31 +1,36 @@
From d2f7a6be1526a6f46cbf37aa27587a51e4d5990f Mon Sep 17 00:00:00 2001
From b3df689acc31c91dbfbfdc0b03a357e6b0eda2ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 23 Aug 2011 13:45:15 +0200
Subject: [PATCH] warnquota configuration tunes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Rest of changes (378a64006bb1e818e84a1c77808563b802b028fa) not
accepted by upstream (we had root@... addresses and more enterprise
wordings usually there).
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
warnquota.c | 2 +-
warnquota.conf | 17 ++++++++---------
2 files changed, 9 insertions(+), 10 deletions(-)
diff --git a/warnquota.c b/warnquota.c
index 08827f2..c7ca6f2 100644
index 009d9e9..93ed1ff 100644
--- a/warnquota.c
+++ b/warnquota.c
@@ -806,7 +806,7 @@ static int readconfigfile(const char *filename, struct configparams *config)
@@ -825,7 +825,7 @@ static int readconfigfile(const char *filename, struct configparams *config)
verify_format(config->group_signature, "GROUP_SIGNATURE");
}
else if (!strcmp(var, "LDAP_MAIL")) {
- if(strcasecmp(value, "true") == 0)
+ if(strncasecmp(value, "true", 4) == 0)
+ if(strncasecmp(value, "true", 4) == 0)
config->use_ldap_mail = 1;
else
config->use_ldap_mail = 0;
diff --git a/warnquota.conf b/warnquota.conf
index 2a72b78..77f6a75 100644
index 59d4f5f..aee2fca 100644
--- a/warnquota.conf
+++ b/warnquota.conf
@@ -4,17 +4,16 @@
@ -64,8 +69,8 @@ index 2a72b78..77f6a75 100644
-SIGNATURE = See you!| Your admin of %h|
+SIGNATURE = root@example.com
# Following text is used for mails about group exceeding quotas
GROUP_MESSAGE = Hello, a group '%i' you're member of use too much space at %h.|\
I chose you to do the cleanup.|Delete group files on the following filesystems:|
GROUP_MESSAGE = Hello,|\
your group %i is using too much disk space at %h.|\
--
1.7.11.4
1.9.3

View File

@ -4,8 +4,8 @@
Name: quota
Summary: System administration tools for monitoring users' disk usage
Epoch: 1
Version: 4.01
Release: 14%{?dist}
Version: 4.02
Release: 1%{?dist}
# quota_nld.c, quotaio_xfs.h: GPLv2
# bylabel.c copied from util-linux: GPLv2+
# svc_socket.c copied from glibc: LGPLv2+
@ -25,50 +25,9 @@ Source1: quota_nld.service
Source2: quota_nld.sysconfig
# Not accepted changes (378a64006bb1e818e84a1c77808563b802b028fa)
# Some of the lines have been superseded by other commits probably.
Patch0: quota-4.01-warnquota.patch
Patch2: quota-3.06-pie.patch
Patch3: quota-3.13-wrong-ports.patch
# Submitted to upstream, SF#3571486
Patch4: quota-4.01-Make-group-warning-message-more-official.patch
# In upstream after 4.01, SF#3571589
Patch5: quota-4.01-define_charset_in_mail.patch
# In upstream after 4.01, SF#3602786, bug #846296
Patch6: quota-4.01-Do-not-fiddle-with-quota-files-on-XFS-and-GFS.patch
# In upstream after 4.01, SF#3602777
Patch7: quota-4.01-quotacheck-Make-sure-d-provides-at-least-as-much-inf.patch
# In upstream after 4.01, SF#3607034
Patch8: quota-4.01-Add-quotasync-1-manual-page.patch
# In upstream after 4.01, SF#3607034
Patch9: quota-4.01-Complete-quotasync-usage.patch
# In upstream after 4.01, SF#3607034
Patch10: quota-4.01-Correct-quotasync-exit-code.patch
# In upstream after 4.01, SF#3607038
Patch11: quota-4.01-Fix-various-usage-mistakes.patch
# In upstream after 4.01, SF#3600120
Patch12: quota-4.01-Recognize-units-at-block-limits-by-setquota.patch
# In upstream after 4.01, SF#3600120
Patch13: quota-4.01-Recognize-block-limit-units-on-setquota-standard-inp.patch
# In upstream after 4.01, SF#3600120
Patch14: quota-4.01-Recognize-units-at-block-limits-by-edquota.patch
# In upstream after 4.01, SF#3600120
Patch15: quota-4.01-Recognize-units-at-inode-limits-by-setquota.patch
# In upstream after 4.01, SF#3600120
Patch16: quota-4.01-Recognize-units-at-inode-limits-by-edquota.patch
# In upstream after 4.01
Patch17: quota-4.01-Close-FILE-handles-on-error.patch
# In upstream after 4.01
Patch18: quota-4.01-Remove-installation-of-manpages-into-section-2.patch
# In upstream after 4.01, <https://sourceforge.net/p/linuxquota/patches/39/>
Patch19: quota-4.01-Add-quotagrpadmins-5-manual-page.patch
# In upstream after 4.01, <https://sourceforge.net/p/linuxquota/patches/39/>
Patch20: quota-4.01-Add-quotatab-5-manual-page.patch
# In upstream after 4.01, <https://sourceforge.net/p/linuxquota/patches/39/>
Patch21: quota-4.01-Add-warnquota.conf-5-manual-page.patch
# In upstream after 4.01, <https://sourceforge.net/p/linuxquota/patches/39/>
Patch22: quota-4.01-Improve-rcp.rquota-8-manual-page.patch
# In upstream after 4.01, <https://sourceforge.net/p/linuxquota/bugs/115/>,
# bug #1072769
Patch23: quota-4.01-Prevent-from-grace-period-overflow-in-RPC-transport.patch
Patch0: quota-4.02-warnquota.patch
Patch1: quota-4.02-Build-rpc.rquotad-as-PIE.patch
Patch2: quota-3.13-wrong-ports.patch
%description
The quota package contains system administration tools for monitoring
@ -140,42 +99,9 @@ Linux/UNIX environment.
%setup -q -n quota-tools
%patch0 -p1
%ifnarch ppc ppc64
%patch2 -p1
%patch1 -p1
%endif
%patch3 -p1
%patch4 -p1 -b .group_warning
%patch5 -p1 -b .charset_in_mail
%patch6 -p1 -b .gfs_files
%patch7 -p1 -b .quotackeck_debug
%patch8 -p1 -b .quotasync_manual
%patch9 -p1 -b .quotasync_usage
%patch10 -p1 -b .quotasync_exit
%patch11 -p1 -b .usage
%patch12 -p1 -b .setquota_block_units
%patch13 -p1 -b .setquota_block_units_stdin
%patch14 -p1 -b .edquota_block_units
%patch15 -p1 -b .setquota_inode_units
%patch16 -p1 -b .edquota_inode_units
%patch17 -p1 -b .close_file_handles
%patch18 -p1 -b .remove_man2
%patch19 -p1 -b .doc_quotagrpadmins
%patch20 -p1 -b .doc_quotatab
%patch21 -p1 -b .doc_warnquota
%patch22 -p1 -b .doc_rquota
%patch23 -p1 -b .rpc_time
#fix typos/mistakes in localized documentation
for pofile in $(find ./po/*.p*)
do
sed -i 's/editting/editing/' "$pofile"
done
# Fix charset
for F in Changelog; do
iconv -f latin1 -t utf-8 <"$F" >"${F}.utf8"
touch -r "$F"{,.utf8}
mv "$F"{.utf8,}
done
%patch2 -p1
%build
@ -259,6 +185,9 @@ install -p -m644 -D %{SOURCE2} \
%changelog
* Wed Nov 26 2014 Petr Pisar <ppisar@redhat.com> - 1:4.02-1
- 4.02 bump
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:4.01-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

View File

@ -1 +1 @@
5c2c31e321d2e1322ce12d69ae5c66d6 quota-4.01.tar.gz
a8a5df262261e659716ccad2a5d6df0d quota-4.02.tar.gz