aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2008-09-30 10:30:20 +0000
committerWerner Koch <[email protected]>2008-09-30 10:30:20 +0000
commit8381a43ca7cb277f70c3c91d66a7cf890b96ffb9 (patch)
treeaef47b3f1a7c1d3f9623afad0e8e0000a2b356dd
parentRemove hacks which are not anymore needed since we now require Libgcrypt 1.4 (diff)
downloadgnupg-8381a43ca7cb277f70c3c91d66a7cf890b96ffb9.tar.gz
gnupg-8381a43ca7cb277f70c3c91d66a7cf890b96ffb9.zip
Add gpgsm server command GETINFO agent-check.
Fix tests.
-rw-r--r--sm/ChangeLog5
-rw-r--r--sm/call-agent.c20
-rw-r--r--sm/gpgsm.h1
-rw-r--r--sm/server.c6
-rw-r--r--tests/ChangeLog4
-rw-r--r--tests/Makefile.am8
-rw-r--r--tests/openpgp/ChangeLog4
-rwxr-xr-xtests/openpgp/clearsig.test4
8 files changed, 48 insertions, 4 deletions
diff --git a/sm/ChangeLog b/sm/ChangeLog
index 21e204f01..2035c543e 100644
--- a/sm/ChangeLog
+++ b/sm/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-30 Werner Koch <[email protected]>
+
+ * server.c (cmd_getinfo): New subcommand agent-check.
+ * call-agent.c (gpgsm_agent_send_nop): New.
+
2008-09-29 Werner Koch <[email protected]>
* certcheck.c (MY_GCRY_PK_ECDSA): Remove. Change users to
diff --git a/sm/call-agent.c b/sm/call-agent.c
index 625ca9d6e..d1dad6d07 100644
--- a/sm/call-agent.c
+++ b/sm/call-agent.c
@@ -328,7 +328,7 @@ gpgsm_agent_pkdecrypt (ctrl_t ctrl, const char *keygrip, const char *desc,
{
int rc;
char line[ASSUAN_LINELENGTH];
- membuf_t data;
+ membuf_t data;
struct cipher_parm_s cipher_parm;
size_t n, len;
char *p, *buf, *endp;
@@ -802,3 +802,21 @@ gpgsm_agent_get_confirmation (ctrl_t ctrl, const char *desc)
default_inq_cb, ctrl, NULL, NULL);
return rc;
}
+
+
+
+/* Return 0 if the agent is alive. This is useful to make sure that
+ an agent has been started. */
+gpg_error_t
+gpgsm_agent_send_nop (ctrl_t ctrl)
+{
+ int rc;
+
+ rc = start_agent (ctrl);
+ if (!rc)
+ rc = assuan_transact (agent_ctx, "NOP",
+ NULL, NULL, NULL, NULL, NULL, NULL);
+ return rc;
+}
+
+
diff --git a/sm/gpgsm.h b/sm/gpgsm.h
index add1928ec..278c6e5fc 100644
--- a/sm/gpgsm.h
+++ b/sm/gpgsm.h
@@ -393,6 +393,7 @@ int gpgsm_agent_marktrusted (ctrl_t ctrl, ksba_cert_t cert);
int gpgsm_agent_learn (ctrl_t ctrl);
int gpgsm_agent_passwd (ctrl_t ctrl, const char *hexkeygrip, const char *desc);
gpg_error_t gpgsm_agent_get_confirmation (ctrl_t ctrl, const char *desc);
+gpg_error_t gpgsm_agent_send_nop (ctrl_t ctrl);
/*-- call-dirmngr.c --*/
int gpgsm_dirmngr_isvalid (ctrl_t ctrl,
diff --git a/sm/server.c b/sm/server.c
index e38d1764a..cd2b9f69a 100644
--- a/sm/server.c
+++ b/sm/server.c
@@ -1016,6 +1016,7 @@ cmd_getauditlog (assuan_context_t ctx, char *line)
version - Return the version of the program.
pid - Return the process id of the server.
+ agent-check - Return success if the agent is running.
*/
static int
@@ -1035,6 +1036,11 @@ cmd_getinfo (assuan_context_t ctx, char *line)
snprintf (numbuf, sizeof numbuf, "%lu", (unsigned long)getpid ());
rc = assuan_send_data (ctx, numbuf, strlen (numbuf));
}
+ else if (!strcmp (line, "agent-check"))
+ {
+ ctrl_t ctrl = assuan_get_pointer (ctx);
+ rc = gpgsm_agent_send_nop (ctrl);
+ }
else
rc = set_error (GPG_ERR_ASS_PARAMETER, "unknown value for WHAT");
return rc;
diff --git a/tests/ChangeLog b/tests/ChangeLog
index c06cfdca6..305303776 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-29 Werner Koch <[email protected]>
+
+ * Makefile.am (TESTS): Remove tests.
+
2008-02-19 Werner Koch <[email protected]>
* Makefile.am: Always run pkits tests.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2dc94f3c1..01013e0d8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -44,7 +44,13 @@ EXTRA_DIST = runtest inittests $(testscripts) \
samplekeys/cert_g10code_test1.pem \
samplekeys/cert_g10code_theo1.pem
-TESTS = $(testscripts)
+# We used to run $(testscripts) here but tehse asschk scripts ares not
+# completely reliable in all enviromnets and thus we better disable
+# them. The tests are anyway way to minimal. We will eventually
+# write new tests based on gpg-connect-agent which has a full fledged
+# script language and thus makes it far easier to write tests than to
+# use the low--level asschk stuff.
+TESTS =
CLEANFILES = inittests.stamp x y y z out err \
*.lock .\#lk*
diff --git a/tests/openpgp/ChangeLog b/tests/openpgp/ChangeLog
index 4ce7b9fc0..118e03a79 100644
--- a/tests/openpgp/ChangeLog
+++ b/tests/openpgp/ChangeLog
@@ -1,3 +1,7 @@
+2008-09-29 Werner Koch <[email protected]>
+
+ * clearsig.test: Replace -sat by --clearsign.
+
2008-03-19 Werner Koch <[email protected]>
* import.test, bug894-test.asc: New.
diff --git a/tests/openpgp/clearsig.test b/tests/openpgp/clearsig.test
index 78f1fa6a9..74631e180 100755
--- a/tests/openpgp/clearsig.test
+++ b/tests/openpgp/clearsig.test
@@ -18,7 +18,7 @@
# it is clear text and not binary text.
# ======================================
for i in $plain_files plain-large ; do
- echo "$usrpass1" | $GPG --passphrase-fd 0 -sat -o x --yes $i
+ echo "$usrpass1" | $GPG --passphrase-fd 0 --clearsign -o x --yes $i
$GPG --verify x
done
@@ -29,7 +29,7 @@ done
if have_pubkey_algo "RSA"; then
for i in $plain_files plain-large ; do
- $GPG -u $usrname3 --rfc1991 --digest-algo md5 -sat -o x --yes $i
+ $GPG -u $usrname3 --rfc1991 --digest-algo md5 --clearsign -o x --yes $i
$GPG --verify x
done
fi