[git] GnuPG - branch, master, updated. gnupg-2.1.17-91-g3daeef7
by Damien Goutte-Gattat
cvs at cvs.gnupg.org
Thu Jan 19 10:41:55 CET 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".
The branch, master has been updated
via 3daeef702b2e6a42f0f396b828f86ffc3f33fc88 (commit)
from 55c9212a2338bf0b07c8cf3a69bcedaa28d48d43 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 3daeef702b2e6a42f0f396b828f86ffc3f33fc88
Author: Damien Goutte-Gattat <dgouttegattat at incenp.org>
Date: Wed Jan 18 18:52:12 2017 +0100
gpg: Allow to freeze faked system time.
* g10/gpg.c (main): If the parameter for --faked-system-time
ends with a '!', freeze time at the specified point.
* common/gettime.c (gnupg_set_time): Allow to freeze the time
at an arbitrary time instead of only the current time.
* doc/gpg.texi: Update documentation for --faked-system-time.
--
This patch allows the user to modify the behavior of the
--faked-system-time option: by appending a '!' to the parameter,
time in GnuPG will be frozen at the specified time, instead of
advancing normally from that time onward.
Signed-off-by: Damien Goutte-Gattat <dgouttegattat at incenp.org>
diff --git a/common/gettime.c b/common/gettime.c
index e5da4fb..3e1ee55 100644
--- a/common/gettime.c
+++ b/common/gettime.c
@@ -133,7 +133,7 @@ gnupg_set_time (time_t newtime, int freeze)
else if (freeze)
{
timemode = FROZEN;
- timewarp = current;
+ timewarp = newtime == (time_t)-1 ? current : newtime;
}
else if (newtime > current)
{
diff --git a/doc/gpg.texi b/doc/gpg.texi
index 4ea2cd2..044ba37 100644
--- a/doc/gpg.texi
+++ b/doc/gpg.texi
@@ -2748,6 +2748,9 @@ forth to @var{epoch} which is the number of seconds elapsed since the year
1970. Alternatively @var{epoch} may be given as a full ISO time string
(e.g. "20070924T154812").
+If you suffix @var{epoch} with an exclamation mark (!), the system time
+will appear to be frozen at the specified time.
+
@item --enable-progress-filter
@opindex enable-progress-filter
Enable certain PROGRESS status outputs. This option allows frontends
diff --git a/g10/gpg.c b/g10/gpg.c
index 8c5b505..f9039ae 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -3493,10 +3493,20 @@ main (int argc, char **argv)
case oFakedSystemTime:
{
- time_t faked_time = isotime2epoch (pargs.r.ret_str);
+ size_t len = strlen (pargs.r.ret_str);
+ int freeze = 0;
+ time_t faked_time;
+
+ if (len > 0 && pargs.r.ret_str[len-1] == '!')
+ {
+ freeze = 1;
+ pargs.r.ret_str[len-1] = '\0';
+ }
+
+ faked_time = isotime2epoch (pargs.r.ret_str);
if (faked_time == (time_t)(-1))
faked_time = (time_t)strtoul (pargs.r.ret_str, NULL, 10);
- gnupg_set_time (faked_time, 0);
+ gnupg_set_time (faked_time, freeze);
}
break;
-----------------------------------------------------------------------
Summary of changes:
common/gettime.c | 2 +-
doc/gpg.texi | 3 +++
g10/gpg.c | 14 ++++++++++++--
3 files changed, 16 insertions(+), 3 deletions(-)
hooks/post-receive
--
The GNU Privacy Guard
http://git.gnupg.org
More information about the Gnupg-commits
mailing list