summaryrefslogtreecommitdiff
path: root/quota_nld.c
Commit message (Collapse)AuthorAgeFilesLines
* quota-nld: fix open PID file failed when systemd read itHEADmasterlihaoxiang (F)2022-12-061-11/+35
| | | | | | | | | | | | | | | | | | Running quota_nld by systemd might cause the problem that systemd couldn't open the PID file generated by quota_nld. In fact, the PID file hasn't existed yet because it originates from the child process of quota_nld which is a daemon process. As the main process exit, systemd try to access the PID file but the daemon hadn't create it that time. In this situation, we move the procedure of creating PID file into the parent process to ensure the PID file must existed when quota_nld exit. After that, the above problem would never occur again. [JK: Fixed up SIGTERM handling and format strings] Signed-off-by: lihaoxiang <lihaoxiang9@huawei.com> Signed-off-by: Jan Kara <jack@suse.cz>
* quota_nld: Initialize sa_mask when registering PID file removalPetr Písař2021-03-161-1/+1
| | | | | | | | term_action.sa_mask is an automatic variable and and thus unitialized. This patch empties the signal mask. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
* Make a directory for quota_nld PID file configurablePetr Písař2019-10-041-2/+2
| | | | | | | | | | | | | | | While Filesystem Hierarchy Standard prescribes /var/run path for storing PID files, some (systemd-based) distributions uses /run. This patch adds a --with-pid-dir=DIRECTORY option to the ./configure script. The option enables to change the path. Default one is /var/run as used to be until now. (I did not use $localstatedir environment variable because Autoconf manual allows using "precious" variables only in a makefile.) Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
* quota_nld: Check daemon() for failuresPetr Písař2019-03-211-1/+4
| | | | | | | | daemon() function can fail. Then we should also report an failure instead of continuing on foreground. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
* warnquota: Fix comparing user name to non-null-terminated utmp.ut_userPetr Písař2018-02-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC 8 with GNU libc 2.27 warns: gcc -DHAVE_CONFIG_H -I. -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/libnl3 -g -O2 -Wall -fPIC -I/usr/include/tirpc -c -o quota_nld-quota_nld.o `test -f 'quota_nld.c' || echo './'`quota_nld.c quota_nld.c: In function ‘write_console_warning’: quota_nld.c:273:7: warning: ‘strcmp’ argument 2 declared attribute ‘nonstring’ [-Wstringop-overflow=] if (strcmp(user, uent->ut_user)) ^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/utmp.h:29, from quota_nld.c:23: /usr/include/bits/utmp.h:65:8: note: argument ‘ut_user’ declared here char ut_user[UT_NAMESIZE] ^~~~~~~ This is because ut_user value misses the terminating null byte if it fits exactly into ut_user array, as document in utmp(5): String fields are terminated by a null byte ('\0') if they are shorter than the size of the field. Recent GCC and glibc recevied compile-time checks and annotations (__attribute_nonstring_) that catches these mistakes. This patch fixes it by using strncmp(3) and by ignoring user names that does not fit into utmp log format. It's better not to warn than spamming unrelated user. Signed-off-by: Petr Písař <ppisar@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
* quota_nld: multicast project quota warnings via dbusMasatake YAMATO2015-12-161-1/+1
| | | | | | | | | | | | Quota subsystem in kernel introduced project quota. This patch improves the userspace side. This patch prevents quota_nld writing warnings to a console when receiving project quota warnings from kernel because there is no such concept, "console associated with a project id". Signed-off-by: Masatake YAMATO <yamato@redhat.com> Signed-off-by: Jan Kara <jack@suse.cz>
* quota_nld: Fix compilation warningJan Kara2013-11-181-0/+1
| | | | | | Fix compilation warning about missing stat(3) prototype. Signed-off-by: Jan Kara <jack@suse.cz>
* quota_nld: Fix usage of netlink multicast groupsJan Kara2013-11-181-24/+39
| | | | | | | | | | quota_nld has used VFS_DQUOT netlink family id as an id of a multicast group to listen to. That is wrong - instead proper multicast group id should be looked up. To do that we need a support for this functionality in libnl so convert quota_nld to use libnl-3.0 and properly lookup multicast group id. Signed-off-by: Jan Kara <jack@suse.cz>
* Store PID of quota_nldPetr Písař2012-02-291-0/+80
| | | | | | | | | | If quota_nld is run as daemon, daemon's PID will be stored into /var/run/${PROGNAME}.pid file and it will be deleted on receiving SIGTERM just before program termination. PID file is used by init scripts to find and kill forked daemon. Signed-off-by: Jan Kara <jack@suse.cz>
* Do not report missing utmp record to syslogPetr Písař2011-08-171-1/+6
| | | | | | | | | If no utmp record can be found there is obviously nobody to read error message about missing TTY in sytem log in real time. Moreover the log is usually illegible for normal user. So it's pointless to log this fact there for user's sake. warnquota can be used instead. Signed-off-by: Jan Kara <jack@suse.cz>
* Make global symbols static as possiblePetr Pisar2011-05-161-3/+3
| | | | | | | | | | | | | | There are some calls (e.g. getpwnam(3)) that can lead to dlopening other libraries that could jump to symbol with name clashing to one of global quota symbols. (e.g. Name server switch plug-in nss_db calls dirname(3) that's already defined in edquota.c and tht can cause segmentation fault.) Although it's not possible to solve all these problems, making as much as possible global objects and functions static is the best thing we can do to avoid name space polution. Signed-off-by: Jan Kara <jack@suse.cz>
* * Rewritten configuration script to create config.h (Jan Kara)jkar85722010-01-051-0/+2
| | | | | * Use /proc/mounts for mountpoint scanning (Jan Kara) * Removed use of reserved identifiers (Jan Kara)
* * Improved manpage of quota_nld (Eddie)jkar85722010-01-051-9/+10
| | | | * Fixed long option handling of quota_nld (Jan Kara)
* * implemented writing of messages that user got below hard/soft limits to ↵jkar85722008-07-121-11/+37
| | | | quota_nld (Jan Kara)
* Format string fixes (Ladislav Michnovic)jkar85722008-04-211-3/+3
|
* Added limits.h include to quota_nld.cjkar85722008-04-141-0/+1
|
* Fixed netlink command detection.jkar85722008-01-171-1/+9
|
* Ported quota_nld to libnl 1.1 (Jan Kara)jkar85722008-01-171-67/+44
|
* Quotaon should work only on local mount points (Jan Kara)jkar85722007-09-181-1/+8
|
* Updated changelog.jkar85722007-06-181-4/+4
| | | | Added manpage for quota_nld.
* Implemented quota netlink daemon.jkar85722007-06-181-0/+367