forked from pool/quota
Accepting request 878313 from Base:System
OBS-URL: https://build.opensuse.org/request/show/878313 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/quota?expand=0&rev=58
This commit is contained in:
commit
bef86f3c2a
@ -1,220 +0,0 @@
|
||||
From 6e631074330aa6ea210b05dae3a2dcf5223b311f Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kara <jack@suse.cz>
|
||||
Date: Thu, 15 Aug 2019 11:19:20 +0200
|
||||
Subject: [PATCH] warnquota: Do not ignore errors in config file
|
||||
|
||||
Currently warnquota ignores unknown variables, or lines we cannot parse
|
||||
in the config file. This is potentially dangerous as that may result
|
||||
in errors being missed and warnquota operating differently than
|
||||
administrator intended. Change warnquota to abort on errors in config
|
||||
file and provide -I option for ignoring errors for backward
|
||||
compatibility.
|
||||
|
||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||
---
|
||||
common.c | 13 ++++++---
|
||||
common.h | 4 +++
|
||||
warnquota.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++-------
|
||||
3 files changed, 85 insertions(+), 14 deletions(-)
|
||||
|
||||
Index: quota-4.05/common.c
|
||||
===================================================================
|
||||
--- quota-4.05.orig/common.c
|
||||
+++ quota-4.05/common.c
|
||||
@@ -61,17 +61,22 @@ void die(int ret, char *fmtstr, ...)
|
||||
exit(ret);
|
||||
}
|
||||
|
||||
-void errstr(char *fmtstr, ...)
|
||||
+void errstrv(char *fmtstr, va_list args)
|
||||
{
|
||||
- va_list args;
|
||||
-
|
||||
- va_start(args, fmtstr);
|
||||
if (enable_syslog)
|
||||
do_syslog(LOG_ERR, fmtstr, args);
|
||||
else {
|
||||
fprintf(stderr, "%s: ", progname);
|
||||
vfprintf(stderr, fmtstr, args);
|
||||
}
|
||||
+}
|
||||
+
|
||||
+void errstr(char *fmtstr, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+
|
||||
+ va_start(args, fmtstr);
|
||||
+ errstrv(fmtstr, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
Index: quota-4.05/common.h
|
||||
===================================================================
|
||||
--- quota-4.05.orig/common.h
|
||||
+++ quota-4.05/common.h
|
||||
@@ -8,6 +8,7 @@
|
||||
#define GUARD_COMMON_H
|
||||
|
||||
#include <time.h>
|
||||
+#include <stdarg.h>
|
||||
|
||||
#ifndef __attribute__
|
||||
# if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 8) || __STRICT_ANSI__
|
||||
@@ -21,6 +22,9 @@ extern char *progname;
|
||||
/* Finish programs being */
|
||||
void __attribute ((noreturn)) die(int, char *, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
|
||||
+/* Print error from va_list */
|
||||
+void errstrv(char *, va_list);
|
||||
+
|
||||
/* Print an error */
|
||||
void errstr(char *, ...) __attribute__ ((__format__ (__printf__, 1, 2)));
|
||||
|
||||
Index: quota-4.05/warnquota.c
|
||||
===================================================================
|
||||
--- quota-4.05.orig/warnquota.c
|
||||
+++ quota-4.05/warnquota.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
+#include <stdarg.h>
|
||||
#include <ctype.h>
|
||||
#include <signal.h>
|
||||
#include <grp.h>
|
||||
@@ -87,6 +88,7 @@
|
||||
#define FL_GROUP 2
|
||||
#define FL_NOAUTOFS 4
|
||||
#define FL_NODETAILS 16
|
||||
+#define FL_IGNORE_CFG_ERR 32
|
||||
|
||||
struct usage {
|
||||
char *devicename;
|
||||
@@ -707,6 +709,22 @@ Unrecognized expression %%%c.\n"), varna
|
||||
}
|
||||
}
|
||||
|
||||
+static void print_cfg_err(char *fmt, ...)
|
||||
+{
|
||||
+ va_list args;
|
||||
+
|
||||
+ va_start(args, fmt);
|
||||
+ errstrv(fmt, args);
|
||||
+ va_end(args);
|
||||
+ if (flags & FL_IGNORE_CFG_ERR) {
|
||||
+ errstr(_("Ignoring error in config file.\n"));
|
||||
+ } else {
|
||||
+ errstr(_("Aborting. Use option -I if you want warnquota to "
|
||||
+ "ignore errors in the config file as it used to in "
|
||||
+ "older versions.\n"));
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* Reads config parameters from configfile
|
||||
* uses default values if errstr occurs
|
||||
@@ -771,9 +789,18 @@ static int readconfigfile(const char *fi
|
||||
continue;
|
||||
}
|
||||
len = bufpos + strlen(buff+bufpos);
|
||||
- if (buff[len-1] != '\n')
|
||||
- errstr(_("Line %d too long. Truncating.\n"), line);
|
||||
- else {
|
||||
+ if (buff[len-1] != '\n') {
|
||||
+ if (len == IOBUF_SIZE-1) {
|
||||
+ print_cfg_err(
|
||||
+ _("line %d: Line too long! Maximum is %d.\n"),
|
||||
+ line, IOBUF_SIZE-1);
|
||||
+ if (flags & FL_IGNORE_CFG_ERR)
|
||||
+ continue;
|
||||
+ return -1;
|
||||
+ }
|
||||
+ /* Last line without \n. Just pretend there is one. */
|
||||
+ len++;
|
||||
+ } else {
|
||||
len--;
|
||||
if (buff[len-1] == '\\') { /* Should join with next line? */
|
||||
bufpos = len-1;
|
||||
@@ -886,15 +913,45 @@ cc_parse_err:
|
||||
sstrncpy(config->ldap_mail_attr, value, CNF_BUFFER);
|
||||
else if(!strcmp(var, "LDAP_DEFAULT_MAIL_DOMAIN"))
|
||||
sstrncpy(config->default_domain, value, CNF_BUFFER);
|
||||
+#else
|
||||
+ else if (!strcmp(var, "LDAP_MAIL") ||
|
||||
+ !strcmp(var, "LDAP_TLS") ||
|
||||
+ !strcmp(var, "LDAP_HOST") ||
|
||||
+ !strcmp(var, "LDAP_PORT") ||
|
||||
+ !strcmp(var, "LDAP_URI") ||
|
||||
+ !strcmp(var, "LDAP_BINDDN") ||
|
||||
+ !strcmp(var, "LDAP_BINDPW") ||
|
||||
+ !strcmp(var, "LDAP_BASEDN") ||
|
||||
+ !strcmp(var, "LDAP_SEARCH_ATTRIBUTE") ||
|
||||
+ !strcmp(var, "LDAP_MAIL_ATTRIBUTE") ||
|
||||
+ !strcmp(var, "LDAP_DEFAULT_MAIL_DOMAIN")) {
|
||||
+ print_cfg_err(_("line %d: LDAP variable in config "
|
||||
+ "file but LDAP support is not compiled.\n"), line);
|
||||
+ if (flags & FL_IGNORE_CFG_ERR)
|
||||
+ continue;
|
||||
+ return -1;
|
||||
+ }
|
||||
#endif
|
||||
- else /* not matched at all */
|
||||
- errstr(_("Error in config file (line %d), ignoring\n"), line);
|
||||
+ else { /* not matched at all */
|
||||
+ print_cfg_err(_("line %d: Unknown variable %s in "
|
||||
+ "config file.\n"), line, var);
|
||||
+ if (flags & FL_IGNORE_CFG_ERR)
|
||||
+ continue;
|
||||
+ return -1;
|
||||
+ }
|
||||
}
|
||||
- else /* no '=' char in this line */
|
||||
- errstr(_("Possible error in config file (line %d), ignoring\n"), line);
|
||||
+ else { /* no '=' char in this line */
|
||||
+ print_cfg_err(_("line %d: Missing '=' in config file.\n"), line);
|
||||
+ if (flags & FL_IGNORE_CFG_ERR)
|
||||
+ continue;
|
||||
+ return -1;
|
||||
+ }
|
||||
+ }
|
||||
+ if (bufpos) {
|
||||
+ print_cfg_err(_("line %d: Unterminated last line.\n"), line);
|
||||
+ if (!(flags & FL_IGNORE_CFG_ERR))
|
||||
+ return -1;
|
||||
}
|
||||
- if (bufpos)
|
||||
- errstr(_("Unterminated last line, ignoring\n"));
|
||||
#ifdef USE_LDAP_MAIL_LOOKUP
|
||||
if (config->use_ldap_mail)
|
||||
{
|
||||
@@ -1041,6 +1098,7 @@ static void usage(void)
|
||||
-c, --config=config-file non-default config file\n\
|
||||
-q, --quota-tab=quotatab-file non-default quotatab\n\
|
||||
-a, --admins-file=admins-file non-default admins file\n\
|
||||
+-I, --ignore-config-errors ignore unknown statements in config file\n\
|
||||
-h, --help display this help message and exit\n\
|
||||
-v, --version display version information and exit\n\n"));
|
||||
errstr(_("Bugs to %s\n"), PACKAGE_BUGREPORT);
|
||||
@@ -1062,10 +1120,11 @@ static void parse_options(int argcnt, ch
|
||||
{ "no-autofs", 0, NULL, 'i' },
|
||||
{ "human-readable", 2, NULL, 's' },
|
||||
{ "no-details", 0, NULL, 'd' },
|
||||
+ { "ignore-config-errors", 0, NULL, 'I' },
|
||||
{ NULL, 0, NULL, 0 }
|
||||
};
|
||||
|
||||
- while ((ret = getopt_long(argcnt, argstr, "ugVF:hc:q:a:is::d", long_opts, NULL)) != -1) {
|
||||
+ while ((ret = getopt_long(argcnt, argstr, "ugVF:hc:q:a:is::dI", long_opts, NULL)) != -1) {
|
||||
switch (ret) {
|
||||
case '?':
|
||||
case 'h':
|
||||
@@ -1105,6 +1164,9 @@ static void parse_options(int argcnt, ch
|
||||
case 'd':
|
||||
flags |= FL_NODETAILS;
|
||||
break;
|
||||
+ case 'I':
|
||||
+ flags |= FL_IGNORE_CFG_ERR;
|
||||
+ break;
|
||||
}
|
||||
}
|
||||
if (!(flags & FL_USER) && !(flags & FL_GROUP))
|
@ -1,145 +0,0 @@
|
||||
From 0efb2331f1c39c9665fb6e92e83c7d080b877de1 Mon Sep 17 00:00:00 2001
|
||||
From: Jan Kara <jack@suse.cz>
|
||||
Date: Mon, 1 Apr 2019 17:28:34 +0200
|
||||
Subject: [PATCH] warnquota: Improve examples in warnquota.conf
|
||||
|
||||
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||
---
|
||||
warnquota.conf | 104 ++++++++++++++++++++++++++++++++++---------------
|
||||
1 file changed, 72 insertions(+), 32 deletions(-)
|
||||
|
||||
diff --git a/warnquota.conf b/warnquota.conf
|
||||
index b06f81f..60b0672 100644
|
||||
--- a/warnquota.conf
|
||||
+++ b/warnquota.conf
|
||||
@@ -1,21 +1,37 @@
|
||||
-# this is an example warnquota.conf
|
||||
+###################################################################
|
||||
+# Configuration file for the warnquota utility
|
||||
+# File Format:
|
||||
+# ^^^^^^^^^^^^
|
||||
+# (1) lines begining with # or ; are comments
|
||||
+# (2) blank lines are ignored
|
||||
+# (3) other lines have the form 'value = string'
|
||||
+# (4) strings may be quoted (double quotes) but they don't have to
|
||||
+# (5) strings may end with backslash in order to continue
|
||||
+# on the next line
|
||||
+# (6) line breaks are marked with '|' character
|
||||
+###################################################################
|
||||
+
|
||||
+#
|
||||
+# Comment this out or remove it once you have edited this config file
|
||||
#
|
||||
-; ; and # type comments are allowed
|
||||
-# and even blank lines
|
||||
+FAIL = "configure /etc/warnquota.conf before running warnquota"
|
||||
|
||||
-# values can be quoted:
|
||||
-#MAIL_CMD = "/usr/my/sendmail/instead/sendmail -t"
|
||||
-MAIL_CMD = "/bin/echo"
|
||||
-FROM = "bas@example.com"
|
||||
-# but they don't have to be:
|
||||
-SUBJECT = Hey, user, clean up your account!
|
||||
-CC_TO = "sysadm@example.com"
|
||||
+#
|
||||
+# command used for sending mails
|
||||
+#
|
||||
+MAIL_CMD = "/usr/lib/sendmail -t"
|
||||
+
|
||||
+#
|
||||
+# Standard mail fields
|
||||
+FROM = "root@localhost"
|
||||
+SUBJECT = "Your account quota has exceeded!"
|
||||
+CC_TO = "root@localhost"
|
||||
# If you set this variable CC will be used only when user has less than
|
||||
# specified grace time left (examples of possible times: 5 seconds, 1 minute,
|
||||
# 12 hours, 5 days)
|
||||
# CC_BEFORE = 2 days
|
||||
-SUPPORT = "support@example.com"
|
||||
-PHONE = "(123) 456-1111 or (222) 333-4444"
|
||||
+SUPPORT = "root@localhost"
|
||||
+PHONE = "123 456 789"
|
||||
# Text in the beginning of the mail (if not specified, default text is used)
|
||||
# This way text can be split to more lines
|
||||
# Line breaks are done by '|' character
|
||||
@@ -45,33 +61,57 @@ GROUP_SIGNATURE = See you!| Your admin|
|
||||
#
|
||||
#Here you can set a charset for emails sent by warnquota (e.g. UTF-8)
|
||||
#CHARSET =
|
||||
-# If you are using LDAP mail lookups.
|
||||
+
|
||||
+##############################################################
|
||||
+# Configuration for LDAP (if you are using LDAP mail lookups)
|
||||
# host, port, tls, binddn, and bindpw are straight forward.
|
||||
-# LDAP_BASEDN is your search base dn
|
||||
-# LDAP_SEARCH_ATTRIBUTE is the attr for the value you are looking for
|
||||
-# LDAP_MAIL_ATTRIBUTE is the attribute you want used for the mail address
|
||||
-# LDAP_DEFAULT_MAIL_DOMAIN is the default domain
|
||||
-# if the attribute isn't found
|
||||
-# if binddn and bindpw are blank or left out, an anonymous bind is used
|
||||
-#
|
||||
-# LDAP_MAIL = false # or true if you want to use it
|
||||
-# If you have at least LDAP 2.3 installed, you should use LDAP_URI
|
||||
+##############################################################
|
||||
+# Your search base dn
|
||||
+#
|
||||
+# LDAP_BASEDN
|
||||
+
|
||||
+# Your search bind dn
|
||||
+#
|
||||
+# LDAP_BINDDN
|
||||
+
|
||||
+# Your search bind password
|
||||
+#
|
||||
+# LDAP_BINDPW
|
||||
+
|
||||
+# The attr for the value you are looking for
|
||||
+#
|
||||
+# LDAP_SEARCH_ATTRIBUTE
|
||||
+
|
||||
+# The attribute you want used for the mail address
|
||||
+#
|
||||
+# LDAP_MAIL_ATTRIBUTE
|
||||
+
|
||||
+# The default domain if the attribute isn't found
|
||||
+#
|
||||
+# LDAP_DEFAULT_MAIL_DOMAIN
|
||||
+
|
||||
+# Whether LDAP support should be used
|
||||
+#
|
||||
+# LDAP_MAIL = false
|
||||
+
|
||||
+# Ldap server. For LDAP >= 2.3 use
|
||||
+#
|
||||
# LDAP_URI = ldaps://my.server:389
|
||||
-# Otherwise you should specify LDAP_HOST and LDAP_PORT
|
||||
-# LDAP_HOST = ldap
|
||||
+#
|
||||
+# For older LDAP libraries use
|
||||
+#
|
||||
+# LDAP_HOST = my.server
|
||||
# LDAP_PORT = 389
|
||||
-# LDAP_TLS = false (false|never|allow|try|demand) use StarTLS
|
||||
-# false - don't use starTLS
|
||||
+
|
||||
+# TLS handling for the connection
|
||||
+#
|
||||
+# LDAP_TLS = (false|never|allow|try|demand)
|
||||
+# false - don't use start TLS
|
||||
# never - don't ask for a certificate
|
||||
# allow - request certificate, proceed even if not verified
|
||||
# try - request certificate, terminate if bad, proceed if not sent
|
||||
# demand - request certificate, proceed only if verified
|
||||
-# LDAP_BINDDN = uid=ReadOnlyUser,o=YourOrg
|
||||
-# LDAP_BINDPW = YourReadOnlyUserPassword
|
||||
-# LDAP_BASEDN = YourSearchBase
|
||||
-# LDAP_SEARCH_ATTRIBUTE = uid
|
||||
-# LDAP_MAIL_ATTRIBUTE = mailLocalAddress
|
||||
-# LDAP_DEFAULT_MAIL_DOMAIN = YourDefaultMailDomain.com
|
||||
+
|
||||
#
|
||||
# end of example warnquota.conf file
|
||||
#
|
||||
--
|
||||
2.22.0
|
||||
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ef3b5b5d1014ed1344b46c1826145e20cbef8db967b522403c9a060761cf7ab9
|
||||
size 577313
|
3
quota-4.06.tar.gz
Normal file
3
quota-4.06.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2f3e03039f378d4f0d97acdb49daf581dcaad64d2e1ddf129495fd579fbd268d
|
||||
size 520448
|
@ -1,3 +1,43 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 8 23:43:44 UTC 2021 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
- update to 4.06:
|
||||
* Remove quot tool (Jan Kara)
|
||||
* quotacheck,quotaon: Suggest using quota feature for ext4 (Jan Kara)
|
||||
* quota: Add --filesystem option (Jan Kara)
|
||||
* quota: Add synopsis for project quota (Jan Kara)
|
||||
* Handle grace time overflows for XFS quotas (Jan Kara)
|
||||
* Support grace period expirations past y2038 for XFS (Darrick J. Wong)
|
||||
* Fix limits setting on XFS filesystem (Jan Kara)
|
||||
* quota-tools: Set FS_DQ_TIMER_MASK for individual xfs grace times (Eric Sandeen)
|
||||
* quota-tools: pass quota type to QCMD for Q_XFS_GETQSTAT (Eric Sandeen)
|
||||
* Fix ignoring disabled quotas (Petr Písař)
|
||||
* warnquota: Initialize all members of a configparams structure (Petr Písař)
|
||||
* warnquota: Free LDAP error message (Petr Písař)
|
||||
* Make a directory for quota_nld PID file configurable (Petr Písař)
|
||||
* warnquota: Clarify that CC_TO gets resolved through LDAP (Jan Kara)
|
||||
* warnquota: Print also additional error info for LDAP errors (Jan Kara)
|
||||
* warnquota: Properly detect LDAP errors (Jan Kara)
|
||||
* warnquota: Do not ignore errors in config file (Jan Kara)
|
||||
* warnquota: Fix help text (Jan Kara)
|
||||
* quotacheck: Skip checking of filesystems with hidded quota files early (Jan Kara)
|
||||
* quotaops: Make error string translatable (Jan Kara)
|
||||
* rpc: Clarify error message when cannot connect to rpc.rquotad (Jan Kara)
|
||||
* setquota: Report failure to obtain quota information (Jan Kara)
|
||||
* quotaops: Do not leak dquot structures on failure (Jan Kara)
|
||||
* quotaops: Do not return partial list from getprivs() (Jan Kara)
|
||||
* Make messages about failures for NFS consistent with local filesystems (Jan Kara)
|
||||
* Delete old documentation (Jan Kara)
|
||||
* COPYING: Update mailing address (Jan Kara)
|
||||
* edquota: Remove forgotten license header (Jan Kara)
|
||||
* configure.ac: add --disable-pie option (Fabrice Fontaine)
|
||||
* warnquota: Improve examples in warnquota.conf (Jan Kara)
|
||||
* Avoid tampering with user CFLAGS (Dmitry V. Levin)
|
||||
* Revert "configure.ac: fix pkg_check_modules calls" (Dmitry V. Levin)
|
||||
* Makefile.am: link with INTLLIBS (Fabrice Fontaine)
|
||||
- drop 0001-warnquota-Do-not-ignore-errors-in-config-file.patch,
|
||||
quota-4.01-warnquota.patch: upstream
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Aug 15 09:40:56 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
|
||||
|
||||
|
14
quota.spec
14
quota.spec
@ -1,7 +1,7 @@
|
||||
#
|
||||
# spec file for package quota
|
||||
#
|
||||
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
|
||||
# Copyright (c) 2021 SUSE LLC
|
||||
#
|
||||
# All modifications and additions to the file contributed by third parties
|
||||
# remain the property of their copyright owners, unless otherwise agreed
|
||||
@ -21,18 +21,16 @@
|
||||
%define _fillupdir %{_localstatedir}/adm/fillup-templates
|
||||
%endif
|
||||
Name: quota
|
||||
Version: 4.05
|
||||
Version: 4.06
|
||||
Release: 0
|
||||
Summary: Disk Quota System
|
||||
License: GPL-2.0-only
|
||||
Group: System/Filesystems
|
||||
URL: http://sourceforge.net/projects/linuxquota/
|
||||
Source0: http://downloads.sourceforge.net/project/linuxquota/quota-tools/%{version}/%{name}-%{version}.tar.gz
|
||||
URL: https://sourceforge.net/projects/linuxquota/
|
||||
Source0: https://downloads.sourceforge.net/project/linuxquota/quota-tools/%{version}/%{name}-%{version}.tar.gz
|
||||
Source1: sysconfig.nfs-quota
|
||||
Source2: quotad.service
|
||||
Source3: quotad_env.sh
|
||||
Patch2: %{name}-4.01-warnquota.patch
|
||||
Patch3: 0001-warnquota-Do-not-ignore-errors-in-config-file.patch
|
||||
BuildRequires: e2fsprogs-devel
|
||||
BuildRequires: openldap2-devel
|
||||
BuildRequires: pkgconfig
|
||||
@ -66,8 +64,6 @@ The quotad init script, which provides quota support on NFS mounts.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
|
||||
%build
|
||||
%configure \
|
||||
@ -76,7 +72,7 @@ The quotad init script, which provides quota support on NFS mounts.
|
||||
--enable-ldapmail \
|
||||
--enable-rpc \
|
||||
--enable-rpcsetquota
|
||||
make %{?_smp_mflags}
|
||||
%make_build
|
||||
|
||||
%install
|
||||
%make_install
|
||||
|
Loading…
x
Reference in New Issue
Block a user