summaryrefslogtreecommitdiffstats
path: root/sm/server.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2008-02-13 17:47:14 +0100
committerWerner Koch <wk@gnupg.org>2008-02-13 17:47:14 +0100
commit0819c1e8ca8b02a1191fc0087a8046bce6770fff (patch)
treefa756b18d2ec580b22b77f0ffec468be76ec79f1 /sm/server.c
parent2008-02-09 Marcus Brinkmann <marcus@g10code.de> (diff)
downloadgnupg2-0819c1e8ca8b02a1191fc0087a8046bce6770fff.tar.xz
gnupg2-0819c1e8ca8b02a1191fc0087a8046bce6770fff.zip
Always search missing certifcates using a running Dirmngr's cache.
Diffstat (limited to 'sm/server.c')
-rw-r--r--sm/server.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/sm/server.c b/sm/server.c
index b9fe2a25e..fbff003f8 100644
--- a/sm/server.c
+++ b/sm/server.c
@@ -1,6 +1,6 @@
/* server.c - Server mode and main entry point
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006,
- * 2007 Free Software Foundation, Inc.
+ * 2007, 2008 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -1007,6 +1007,36 @@ cmd_getauditlog (assuan_context_t ctx, char *line)
}
+/* GETINFO <what>
+
+ Multipurpose function to return a variety of information.
+ Supported values for WHAT are:
+
+ version - Return the version of the program.
+ pid - Return the process id of the server.
+
+ */
+static int
+cmd_getinfo (assuan_context_t ctx, char *line)
+{
+ int rc;
+
+ if (!strcmp (line, "version"))
+ {
+ const char *s = VERSION;
+ rc = assuan_send_data (ctx, s, strlen (s));
+ }
+ else if (!strcmp (line, "pid"))
+ {
+ char numbuf[50];
+
+ snprintf (numbuf, sizeof numbuf, "%lu", (unsigned long)getpid ());
+ rc = assuan_send_data (ctx, numbuf, strlen (numbuf));
+ }
+ else
+ rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT");
+ return rc;
+}
@@ -1036,6 +1066,7 @@ register_commands (assuan_context_t ctx)
{ "GENKEY", cmd_genkey },
{ "DELKEYS", cmd_delkeys },
{ "GETAUDITLOG", cmd_getauditlog },
+ { "GETINFO", cmd_getinfo },
{ NULL }
};
int i, rc;