aboutsummaryrefslogtreecommitdiffstats
path: root/sm/server.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-11-10 16:01:19 +0000
committerWerner Koch <[email protected]>2016-11-10 16:07:28 +0000
commit5d13581f4737c18430f6572dd4ef486d1ad80dd1 (patch)
treed90f1618778b7534bb195aa7c09060cb631484dd /sm/server.c
parentsm: Remove unused arg SECRET from keydb functions. (diff)
downloadgnupg-5d13581f4737c18430f6572dd4ef486d1ad80dd1.tar.gz
gnupg-5d13581f4737c18430f6572dd4ef486d1ad80dd1.zip
gpg,sm: Add STATUS_ERROR keydb_search and keydb_add-resource.
* g10/keydb.c (keydb_add_resource): Make ANY_REGISTERED file-global. Write a STATUS_ERROR. (maybe_create_keyring_or_box): Check for non-accessible but existant file. (keydb_search): Write a STATUS_ERROR if no keyring has been registered but continue to return NOT_FOUND. * sm/keydb.c (keydb_add_resource): Rename ANY_PUBLIC to ANY_REGISTERED and make file-global. Write a STATUS_ERROR. (keydb_search): Write a STATUS_ERROR if no keyring has been registered but continue to return NOT_FOUND. Also add new arg CTRL and change all callers to pass it down. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'sm/server.c')
-rw-r--r--sm/server.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/sm/server.c b/sm/server.c
index d6a2dbbdd..0fadcadd9 100644
--- a/sm/server.c
+++ b/sm/server.c
@@ -1179,7 +1179,7 @@ cmd_passwd (assuan_context_t ctx, char *line)
line = skip_options (line);
- err = gpgsm_find_cert (line, NULL, &cert);
+ err = gpgsm_find_cert (ctrl, line, NULL, &cert);
if (err)
;
else if (!(grip = gpgsm_get_keygrip_hexstring (cert)))
@@ -1469,6 +1469,19 @@ gpgsm_status_with_err_code (ctrl_t ctrl, int no, const char *text,
return gpgsm_status2 (ctrl, no, buf, NULL);
}
+gpg_error_t
+gpgsm_status_with_error (ctrl_t ctrl, int no, const char *text,
+ gpg_error_t err)
+{
+ char buf[30];
+
+ snprintf (buf, sizeof buf, "%u", err);
+ if (text)
+ return gpgsm_status2 (ctrl, no, text, buf, NULL);
+ else
+ return gpgsm_status2 (ctrl, no, buf, NULL);
+}
+
/* Helper to notify the client about Pinentry events. Because that
might disturb some older clients, this is only done when enabled