[svn] GnuPG - r4876 - in trunk: agent g10 scd sm
svn author wk
cvs at cvs.gnupg.org
Tue Nov 18 19:01:04 CET 2008
Author: wk
Date: 2008-11-18 19:01:03 +0100 (Tue, 18 Nov 2008)
New Revision: 4876
Modified:
trunk/agent/ChangeLog
trunk/agent/gpg-agent.c
trunk/g10/ChangeLog
trunk/g10/gpg.c
trunk/g10/gpgv.c
trunk/scd/ChangeLog
trunk/scd/scdaemon.c
trunk/sm/ChangeLog
trunk/sm/gpgsm.c
Log:
Print library versions according to GNU standards.
Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog 2008-11-18 17:15:07 UTC (rev 4875)
+++ trunk/agent/ChangeLog 2008-11-18 18:01:03 UTC (rev 4876)
@@ -1,3 +1,8 @@
+2008-11-18 Werner Koch <wk at g10code.com>
+
+ * gpg-agent.c (make_libversion): New.
+ (my_strusage): Print libgcrypt version
+
2008-11-11 Werner Koch <wk at g10code.com>
* call-scd.c (membuf_data_cb): Change return type to
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2008-11-18 17:15:07 UTC (rev 4875)
+++ trunk/g10/ChangeLog 2008-11-18 18:01:03 UTC (rev 4876)
@@ -1,3 +1,11 @@
+2008-11-18 Werner Koch <wk at g10code.com>
+
+ * gpg.c (build_lib_list): Remove.
+ (make_libversion): New.
+ (my_strusage): Use it.
+ * gpgv.c (make_libversion): New.
+ (my_strusage): Print libgcrypt version.
+
2008-11-13 Werner Koch <wk at g10code.com>
* gpgv.c: Use new ARGPARSE macros and re-indent.
Modified: trunk/scd/ChangeLog
===================================================================
--- trunk/scd/ChangeLog 2008-11-18 17:15:07 UTC (rev 4875)
+++ trunk/scd/ChangeLog 2008-11-18 18:01:03 UTC (rev 4876)
@@ -1,3 +1,8 @@
+2008-11-18 Werner Koch <wk at g10code.com>
+
+ * scdaemon.c (make_libversion): New.
+ (my_strusage): Print libgcrypt and libksba version.
+
2008-11-03 Werner Koch <wk at g10code.com>
* command.c (server_local_s): Add field DISCONNECT_ALLOWED.
Modified: trunk/sm/ChangeLog
===================================================================
--- trunk/sm/ChangeLog 2008-11-18 17:15:07 UTC (rev 4875)
+++ trunk/sm/ChangeLog 2008-11-18 18:01:03 UTC (rev 4876)
@@ -1,3 +1,9 @@
+2008-11-18 Werner Koch <wk at g10code.com>
+
+ * gpgsm.c (make_libversion): New.
+ (my_strusage): Use new fucntion.
+ (build_lib_list): Remove.
+
2008-11-13 Werner Koch <wk at g10code.com>
* gpgsm.c: Remove all unused options. Use ARGPARSE macros.
Modified: trunk/agent/gpg-agent.c
===================================================================
--- trunk/agent/gpg-agent.c 2008-11-18 17:15:07 UTC (rev 4875)
+++ trunk/agent/gpg-agent.c 2008-11-18 18:01:03 UTC (rev 4876)
@@ -280,11 +280,30 @@
Functions.
*/
+static char *
+make_libversion (const char *libname, const char *(*getfnc)(const char*))
+{
+ const char *s;
+ char *result;
+
+ if (maybe_setuid)
+ {
+ gcry_control (GCRYCTL_INIT_SECMEM, 0, 0); /* Drop setuid. */
+ maybe_setuid = 0;
+ }
+ s = getfnc (NULL);
+ result = xmalloc (strlen (libname) + 1 + strlen (s) + 1);
+ strcpy (stpcpy (stpcpy (result, libname), " "), s);
+ return result;
+}
+
static const char *
my_strusage (int level)
{
+ static char *ver_gcry;
const char *p;
+
switch (level)
{
case 11: p = "gpg-agent (GnuPG)";
@@ -293,6 +312,12 @@
case 17: p = PRINTABLE_OS_NAME; break;
case 19: p = _("Please report bugs to <" PACKAGE_BUGREPORT ">.\n");
break;
+ case 20:
+ if (!ver_gcry)
+ ver_gcry = make_libversion ("libgcrypt", gcry_check_version);
+ p = ver_gcry;
+ break;
+
case 1:
case 40: p = _("Usage: gpg-agent [options] (-h for help)");
break;
Modified: trunk/g10/gpg.c
===================================================================
--- trunk/g10/gpg.c 2008-11-18 17:15:07 UTC (rev 4875)
+++ trunk/g10/gpg.c 2008-11-18 18:01:03 UTC (rev 4876)
@@ -766,7 +766,6 @@
static char *build_list( const char *text, char letter,
const char *(*mapf)(int), int (*chkf)(int) );
-static char *build_lib_list (const char *text);
static void set_cmd( enum cmd_and_opt_values *ret_cmd,
enum cmd_and_opt_values new_cmd );
static void print_mds( const char *fname, int algo );
@@ -776,11 +775,30 @@
static void emergency_cleanup (void);
+static char *
+make_libversion (const char *libname, const char *(*getfnc)(const char*))
+{
+ const char *s;
+ char *result;
+
+ if (maybe_setuid)
+ {
+ gcry_control (GCRYCTL_INIT_SECMEM, 0, 0); /* Drop setuid. */
+ maybe_setuid = 0;
+ }
+ s = getfnc (NULL);
+ result = xmalloc (strlen (libname) + 1 + strlen (s) + 1);
+ strcpy (stpcpy (stpcpy (result, libname), " "), s);
+ return result;
+}
+
+
static const char *
my_strusage( int level )
{
- static char *digests, *pubkeys, *ciphers, *zips, *libs;
- const char *p;
+ static char *digests, *pubkeys, *ciphers, *zips, *ver_gcry;
+ const char *p;
+
switch( level ) {
case 11: p = "gpg (GnuPG)";
break;
@@ -790,14 +808,20 @@
_("Please report bugs to <gnupg-bugs at gnu.org>.\n");
break;
+ case 20:
+ if (!ver_gcry)
+ ver_gcry = make_libversion ("libgcrypt", gcry_check_version);
+ p = ver_gcry;
+ break;
+
#ifdef IS_DEVELOPMENT_VERSION
- case 20:
+ case 25:
p="NOTE: THIS IS A DEVELOPMENT VERSION!";
break;
- case 21:
+ case 26:
p="It is only intended for test purposes and should NOT be";
break;
- case 22:
+ case 27:
p="used in a production environment or with production keys!";
break;
#endif
@@ -847,11 +871,6 @@
check_compress_algo);
p = zips;
break;
- case 38:
- if (!libs)
- libs = build_lib_list(_("Used libraries:"));
- p = libs;
- break;
default: p = NULL;
}
@@ -914,46 +933,6 @@
}
-static char *
-build_lib_list (const char *text)
-{
- struct { const char *name; const char *version; } array[3];
- int idx;
- size_t n;
- char *list, *p;
-
- if (maybe_setuid)
- gcry_control (GCRYCTL_INIT_SECMEM, 0, 0); /* Drop setuid. */
-
- idx = 0;
- array[idx].name = "gcrypt";
- array[idx++].version = gcry_check_version (NULL);
- array[idx].name = NULL;
- array[idx++].version = NULL;
-
- n = strlen (text) + 1;
- for (idx=0; array[idx].name; idx++)
- {
- n += 2 + strlen (array[idx].name);
- if (array[idx].version)
- n += 1 + strlen (array[idx].version) + 1;
- }
- n++;
- list = xmalloc (n+1);
- p = stpcpy (stpcpy (list, text), " ");
- for (idx=0; array[idx].name; idx++)
- {
- if (idx)
- p = stpcpy (p, ", ");
- p = stpcpy (p, array[idx].name);
- if (array[idx].version)
- p = stpcpy (stpcpy (stpcpy (p, "("), array[idx].version), ")");
- }
- strcpy (p, "\n");
- return list;
-}
-
-
static void
wrong_args( const char *text)
{
Modified: trunk/g10/gpgv.c
===================================================================
--- trunk/g10/gpgv.c 2008-11-18 17:15:07 UTC (rev 4875)
+++ trunk/g10/gpgv.c 2008-11-18 18:01:03 UTC (rev 4876)
@@ -87,10 +87,24 @@
int g10_errors_seen = 0;
+static char *
+make_libversion (const char *libname, const char *(*getfnc)(const char*))
+{
+ const char *s;
+ char *result;
+
+ s = getfnc (NULL);
+ result = xmalloc (strlen (libname) + 1 + strlen (s) + 1);
+ strcpy (stpcpy (stpcpy (result, libname), " "), s);
+ return result;
+}
+
static const char *
my_strusage( int level )
{
+ static char *ver_gcry;
const char *p;
+
switch (level)
{
case 11: p = "gpgv (GnuPG)";
@@ -106,6 +120,13 @@
"Check signatures against known trusted keys\n");
break;
+ case 20:
+ if (!ver_gcry)
+ ver_gcry = make_libversion ("libgcrypt", gcry_check_version);
+ p = ver_gcry;
+ break;
+
+
default: p = NULL;
}
return p;
Modified: trunk/scd/scdaemon.c
===================================================================
--- trunk/scd/scdaemon.c 2008-11-18 17:15:07 UTC (rev 4875)
+++ trunk/scd/scdaemon.c 2008-11-18 18:01:03 UTC (rev 4876)
@@ -200,10 +200,30 @@
+static char *
+make_libversion (const char *libname, const char *(*getfnc)(const char*))
+{
+ const char *s;
+ char *result;
+
+ if (maybe_setuid)
+ {
+ gcry_control (GCRYCTL_INIT_SECMEM, 0, 0); /* Drop setuid. */
+ maybe_setuid = 0;
+ }
+ s = getfnc (NULL);
+ result = xmalloc (strlen (libname) + 1 + strlen (s) + 1);
+ strcpy (stpcpy (stpcpy (result, libname), " "), s);
+ return result;
+}
+
+
static const char *
my_strusage (int level)
{
+ static char *ver_gcry, *ver_ksba;
const char *p;
+
switch (level)
{
case 11: p = "scdaemon (GnuPG)";
@@ -212,6 +232,16 @@
case 17: p = PRINTABLE_OS_NAME; break;
case 19: p = _("Please report bugs to <" PACKAGE_BUGREPORT ">.\n");
break;
+ case 20:
+ if (!ver_gcry)
+ ver_gcry = make_libversion ("libgcrypt", gcry_check_version);
+ p = ver_gcry;
+ break;
+ case 21:
+ if (!ver_ksba)
+ ver_ksba = make_libversion ("libksba", ksba_check_version);
+ p = ver_ksba;
+ break;
case 1:
case 40: p = _("Usage: scdaemon [options] (-h for help)");
break;
Modified: trunk/sm/gpgsm.c
===================================================================
--- trunk/sm/gpgsm.c 2008-11-18 17:15:07 UTC (rev 4875)
+++ trunk/sm/gpgsm.c 2008-11-18 18:01:03 UTC (rev 4876)
@@ -413,7 +413,6 @@
static char *build_list (const char *text,
const char *(*mapf)(int), int (*chkf)(int));
-static char *build_lib_list (const char *text);
static void set_cmd (enum cmd_and_opt_values *ret_cmd,
enum cmd_and_opt_values new_cmd );
@@ -479,10 +478,29 @@
}
+static char *
+make_libversion (const char *libname, const char *(*getfnc)(const char*))
+{
+ const char *s;
+ char *result;
+
+ if (maybe_setuid)
+ {
+ gcry_control (GCRYCTL_INIT_SECMEM, 0, 0); /* Drop setuid. */
+ maybe_setuid = 0;
+ }
+ s = getfnc (NULL);
+ result = xmalloc (strlen (libname) + 1 + strlen (s) + 1);
+ strcpy (stpcpy (stpcpy (result, libname), " "), s);
+ return result;
+}
+
+
static const char *
my_strusage( int level )
{
- static char *digests, *pubkeys, *ciphers, *libs;
+ static char *digests, *pubkeys, *ciphers;
+ static char *ver_gcry, *ver_ksba;
const char *p;
switch (level)
@@ -502,6 +520,17 @@
"default operation depends on the input data\n");
break;
+ case 20:
+ if (!ver_gcry)
+ ver_gcry = make_libversion ("libgcrypt", gcry_check_version);
+ p = ver_gcry;
+ break;
+ case 21:
+ if (!ver_ksba)
+ ver_ksba = make_libversion ("libksba", ksba_check_version);
+ p = ver_ksba;
+ break;
+
case 31: p = "\nHome: "; break;
case 32: p = opt.homedir; break;
case 33: p = _("\nSupported algorithms:\n"); break;
@@ -522,11 +551,6 @@
digests = build_list("Hash: ", gcry_md_algo_name, our_md_test_algo );
p = digests;
break;
- case 38:
- if (!libs)
- libs = build_lib_list(_("Used libraries:"));
- p = libs;
- break;
default: p = NULL; break;
}
@@ -566,50 +590,7 @@
return list;
}
-static char *
-build_lib_list (const char *text)
-{
- struct { const char *name; const char *version; } array[5];
- int idx;
- size_t n;
- char *list, *p;
- if (maybe_setuid)
- gcry_control (GCRYCTL_INIT_SECMEM, 0, 0); /* Drop setuid. */
-
- idx = 0;
- array[idx].name = "gcrypt";
- array[idx++].version = gcry_check_version (NULL);
- array[idx].name = "ksba";
- array[idx++].version = ksba_check_version (NULL);
- array[idx].name = "assuan";
- array[idx++].version = GNUPG_LIBASSUAN_VERSION;
- array[idx].name = NULL;
- array[idx++].version = NULL;
-
- n = strlen (text) + 1;
- for (idx=0; array[idx].name; idx++)
- {
- n += 2 + strlen (array[idx].name);
- if (array[idx].version)
- n += 1 + strlen (array[idx].version) + 1;
- }
- n++;
- list = xmalloc (n+1);
- p = stpcpy (stpcpy (list, text), " ");
- for (idx=0; array[idx].name; idx++)
- {
- if (idx)
- p = stpcpy (p, ", ");
- p = stpcpy (p, array[idx].name);
- if (array[idx].version)
- p = stpcpy (stpcpy (stpcpy (p, "("), array[idx].version), ")");
- }
- strcpy (p, "\n");
- return list;
-}
-
-
/* Set the file pointer into binary mode if required. */
static void
set_binary (FILE *fp)
@@ -939,7 +920,7 @@
}
- /* initialize the secure memory. */
+ /* Initialize the secure memory. */
gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0);
maybe_setuid = 0;
More information about the Gnupg-commits
mailing list