Commit 0f7fb157 authored by Mike Hibler's avatar Mike Hibler
Browse files

Make an mtime in the future a warning rather than a fatal error.

parent 2c0995ab
/* /*
* Copyright (c) 2010-2017 University of Utah and the Flux Group. * Copyright (c) 2010-2018 University of Utah and the Flux Group.
* *
* {{{EMULAB-LICENSE * {{{EMULAB-LICENSE
* *
...@@ -1264,12 +1264,19 @@ handle_put(int sock, struct sockaddr_in *sip, struct sockaddr_in *cip, ...@@ -1264,12 +1264,19 @@ handle_put(int sock, struct sockaddr_in *sip, struct sockaddr_in *cip,
* They gave us an mtime and it is "bad", return an error. * They gave us an mtime and it is "bad", return an error.
* XXX somewhat arbitrary: cannot set a time in the future. * XXX somewhat arbitrary: cannot set a time in the future.
* XXX cut them some slack on the future time thing, up to 10s okay. * XXX cut them some slack on the future time thing, up to 10s okay.
* XXX even more slack, just warn and set time to our current time.
*/ */
if (mtime) { if (mtime) {
struct timeval now; struct timeval now;
gettimeofday(&now, NULL); gettimeofday(&now, NULL);
if (mtime > (now.tv_sec + 10)) { if (mtime > (now.tv_sec + 10)) {
#if 1
FrisWarning("%s: attempt to set mtime in the future "
"(%u > %u), setting to current time\n",
imageid, mtime, now.tv_sec);
mtime = 0;
#else
rv = MS_ERROR_BADMTIME; rv = MS_ERROR_BADMTIME;
FrisWarning("%s: client %s %s failed: " FrisWarning("%s: client %s %s failed: "
"attempt to set mtime in the future " "attempt to set mtime in the future "
...@@ -1277,6 +1284,7 @@ handle_put(int sock, struct sockaddr_in *sip, struct sockaddr_in *cip, ...@@ -1277,6 +1284,7 @@ handle_put(int sock, struct sockaddr_in *sip, struct sockaddr_in *cip,
imageid, clientip, op, mtime, now.tv_sec); imageid, clientip, op, mtime, now.tv_sec);
msg->body.putreply.error = rv; msg->body.putreply.error = rv;
goto reply; goto reply;
#endif
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment