summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-01-19 17:15:30 +0100
committerWerner Koch <wk@gnupg.org>2009-01-19 17:15:30 +0100
commit68fd14b144d44cc94c84fc5a4fb05a488eb06b4f (patch)
tree61fb8474e5968f1d6d2d96fd07edd3e4aca861ec /common
parentAdd a sample key. (diff)
downloadgnupg2-68fd14b144d44cc94c84fc5a4fb05a488eb06b4f.tar.xz
gnupg2-68fd14b144d44cc94c84fc5a4fb05a488eb06b4f.zip
Add a few translations to the audit-log.
Diffstat (limited to 'common')
-rw-r--r--common/ChangeLog9
-rw-r--r--common/audit.c28
-rw-r--r--common/convert.c4
3 files changed, 37 insertions, 4 deletions
diff --git a/common/ChangeLog b/common/ChangeLog
index 4dd772d7e..f9e0fa4b0 100644
--- a/common/ChangeLog
+++ b/common/ChangeLog
@@ -1,3 +1,10 @@
+2009-01-19 Werner Koch <wk@g10code.com>
+
+ * audit.c (writeout_li): Translate a few more result strings.
+ Fixes bug#970.
+
+ * convert.c (hex2str): Fix optimization to append a nul character.
+
2008-12-05 Werner Koch <wk@g10code.com>
* percent.c, t-percent.c: New.
@@ -1309,7 +1316,7 @@
Copyright 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008 Free Software Foundation, Inc.
+ 2008, 2009 Free Software Foundation, Inc.
This file is free software; as a special exception the author gives
unlimited permission to copy and/or distribute it, with or without
diff --git a/common/audit.c b/common/audit.c
index 3bb128d51..a3c5b80d5 100644
--- a/common/audit.c
+++ b/common/audit.c
@@ -451,18 +451,42 @@ writeout_li (audit_ctx_t ctx, const char *oktext, const char *format, ...)
if (ctx->use_html && format && oktext)
{
- if (!strcmp (oktext, "Yes"))
+ if (!strcmp (oktext, "Yes")
+ || !strcmp (oktext, "good") )
color = "green";
- else if (!strcmp (oktext, "No"))
+ else if (!strcmp (oktext, "No")
+ || !strcmp (oktext, "bad") )
color = "red";
}
if (format && oktext)
{
+ const char *s = NULL;
+
if (!strcmp (oktext, "Yes"))
oktext = _("Yes");
else if (!strcmp (oktext, "No"))
oktext = _("No");
+ else if (!strcmp (oktext, "good"))
+ {
+ /* TRANSLATORS: Copy the prefix between the vertical bars
+ verbatim. It will not be printed. */
+ oktext = _("|audit-log-result|Good");
+ }
+ else if (!strcmp (oktext, "bad"))
+ oktext = _("|audit-log-result|Bad");
+ else if (!strcmp (oktext, "unsupported"))
+ oktext = _("|audit-log-result|Not supported");
+ else if (!strcmp (oktext, "no-cert"))
+ oktext = _("|audit-log-result|No certificate");
+ else if (!strcmp (oktext, "error"))
+ oktext = _("|audit-log-result|Error");
+ else
+ s = "";
+
+ /* If we have set a prefix, skip it. */
+ if (!s && *oktext == '|' && (s=strchr (oktext+1,'|')))
+ oktext = s+1;
}
if (ctx->use_html)
diff --git a/common/convert.c b/common/convert.c
index c946b81b1..d3e8b642e 100644
--- a/common/convert.c
+++ b/common/convert.c
@@ -194,7 +194,9 @@ hex2str (const char *hexstring, char *buffer, size_t bufsize, size_t *buflen)
;
if (*s && (!isascii (*s) || !isspace (*s)) )
return NULL; /* Not followed by Nul or white space. */
- need_nul = !(s[-2] == '0' && s[-1] == '0');
+ /* We need to append a nul character. However we don't want that if
+ the hexstring already ends with "00". */
+ need_nul = ((s == hexstring) || !(s[-2] == '0' && s[-1] == '0'));
if (need_nul)
count++;