ref: c6b2ad583e16ac79d09206fea140ff0c724e81c0
parent: 8ea917d119179cc4e712f29815b535e06d14599d
author: cinap_lenrek <[email protected]>
date: Thu Jan 26 17:09:44 EST 2017
auth/keyfs: use ulong for time
--- a/sys/src/cmd/auth/keyfs.c
+++ b/sys/src/cmd/auth/keyfs.c
@@ -62,7 +62,7 @@
int ref;
char removed;
uchar warnings;
- long purgatory; /* time purgatory ends */
+ ulong purgatory; /* time purgatory ends */
ulong uniq;
User *link;
};
@@ -463,9 +463,9 @@
case Qsecret:
if(f->user->status != Sok)
return "user disabled";
- if(f->user->purgatory > time(0))
+ if(f->user->purgatory > (ulong)time(0))
return "user in purgatory";
- if(f->user->expire != 0 && f->user->expire < time(0))
+ if(f->user->expire != 0 && f->user->expire < (ulong)time(0))
return "user expired";
m = 0;
switch(f->qtype){
@@ -500,7 +500,7 @@
thdr.count = n;
return 0;
case Qstatus:
- if(f->user->status == Sok && f->user->expire && f->user->expire < time(0))
+ if(f->user->status == Sok && f->user->expire && f->user->expire < (ulong)time(0))
sprint(data, "expired\n");
else
sprint(data, "%s\n", status[f->user->status]);
@@ -592,11 +592,11 @@
else
f->user->bad++;
if(f->user->bad && ((f->user->bad)%MAXBAD) == 0)
- f->user->purgatory = time(0) + f->user->bad;
+ f->user->purgatory = (ulong)time(0) + f->user->bad;
return 0;
case Qwarnings:
data[n] = '\0';
- f->user->warnings = strtoul(data, 0, 10);
+ f->user->warnings = strtoul(data, nil, 10);
thdr.count = n;
break;
case Qroot:
@@ -1033,10 +1033,10 @@
{
char *err;
int n;
- long now, lastwarning;
+ ulong now, lastwarning;
/* after restart, let the system settle for 5 mins before warning */
- lastwarning = time(0) - 24*60*60 + 5*60;
+ lastwarning = (ulong)time(0) - 24*60*60 + 5*60;
while((n = read9pmsg(in, mdata, messagesize)) != 0){
if(n < 0)
@@ -1064,7 +1064,7 @@
error("mount write");
now = time(0);
- if(warnarg && (now - lastwarning > 24*60*60)){
+ if(warnarg && (long)(now - lastwarning) > 24*60*60){
syslog(0, "auth", "keyfs starting warnings: %lux %lux",
now, lastwarning);
warning();
@@ -1077,7 +1077,7 @@
newkeys(void)
{
Dir *d;
- static long ftime;
+ static ulong ftime;
d = dirstat(userkeys);
if(d == nil)
--- a/sys/src/cmd/auth/lib/getexpiration.c
+++ b/sys/src/cmd/auth/lib/getexpiration.c
@@ -49,7 +49,7 @@
if(buf[0]){
if(strncmp(buf, "never", 5)){
- secs = atoi(buf);
+ secs = strtoul(buf, nil, 10);
memmove(&date, localtime(secs), sizeof(date));
sprint(buf, "%4.4d%2.2d%2.2d", date.year+1900, date.mon+1, date.mday);
} else