aboutsummaryrefslogtreecommitdiffstats
path: root/g10/server.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2008-02-13 16:47:14 +0000
committerWerner Koch <[email protected]>2008-02-13 16:47:14 +0000
commit0819c1e8ca8b02a1191fc0087a8046bce6770fff (patch)
treefa756b18d2ec580b22b77f0ffec468be76ec79f1 /g10/server.c
parent2008-02-09 Marcus Brinkmann <[email protected]> (diff)
downloadgnupg-0819c1e8ca8b02a1191fc0087a8046bce6770fff.tar.gz
gnupg-0819c1e8ca8b02a1191fc0087a8046bce6770fff.zip
Always search missing certifcates using a running Dirmngr's cache.
Diffstat (limited to 'g10/server.c')
-rw-r--r--g10/server.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/g10/server.c b/g10/server.c
index 7e783e51e..6ca7dfa8b 100644
--- a/g10/server.c
+++ b/g10/server.c
@@ -1,5 +1,5 @@
/* server.c - server mode for gpg
- * Copyright (C) 2006 Free Software Foundation, Inc.
+ * Copyright (C) 2006, 2008 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -386,7 +386,36 @@ cmd_genkey (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;
+}
@@ -414,6 +443,7 @@ register_commands (assuan_context_t ctx)
{ "LISTSECRETKEYS",cmd_listsecretkeys },
{ "GENKEY", cmd_genkey },
{ "DELKEYS", cmd_delkeys },
+ { "GETINFO", cmd_getinfo },
{ NULL }
};
int i, rc;