aboutsummaryrefslogtreecommitdiffstats
path: root/scd/scdaemon.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--scd/scdaemon.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/scd/scdaemon.c b/scd/scdaemon.c
index b65f47e46..8cabec5e6 100644
--- a/scd/scdaemon.c
+++ b/scd/scdaemon.c
@@ -200,10 +200,30 @@ static int fixed_gcry_pth_init (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 *ver_gcry, *ver_ksba;
const char *p;
+
switch (level)
{
case 11: p = "scdaemon (GnuPG)";
@@ -212,6 +232,16 @@ my_strusage (int level)
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;