summaryrefslogtreecommitdiff
path: root/quotasys.h
diff options
context:
space:
mode:
authorPetr Písař <ppisar@redhat.com>2014-02-24 15:54:32 +0100
committerJan Kara <jack@suse.cz>2014-05-01 19:40:44 +0200
commitd850a85b2374fe1b83779c0fc61463057eeca4ab (patch)
tree67d0bccb4b3f383e21b01719381ea878e2b6d2c9 /quotasys.h
parent7cc53f085ba8b8efe1887d1c5cfdeb7b61f904d2 (diff)
downloadlinuxquota-d850a85b2374fe1b83779c0fc61463057eeca4ab.tar.gz
Prevent from grace period overflow in RPC transport
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> Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'quotasys.h')
-rw-r--r--quotasys.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/quotasys.h b/quotasys.h
index e79f8cd..d8d79fe 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);