summaryrefslogtreecommitdiffstats
path: root/sm/server.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2001-12-13 10:09:11 +0100
committerWerner Koch <wk@gnupg.org>2001-12-13 10:09:11 +0100
commit9e241878a64b17ddafbe7a151cf56495a973d824 (patch)
tree25a581081bd088a1c5f12648972e8d861b94a455 /sm/server.c
parentFixed INPUT/OUTPUT command (diff)
downloadgnupg2-9e241878a64b17ddafbe7a151cf56495a973d824.tar.xz
gnupg2-9e241878a64b17ddafbe7a151cf56495a973d824.zip
Made decryption work in --server mode, allow output of plain base64,
allow --armor and --base64 arguments for INPUT and OUTPUT, new global option --base64, cleaned up the help page.
Diffstat (limited to '')
-rw-r--r--sm/server.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/sm/server.c b/sm/server.c
index 8a345d571..0f969be7b 100644
--- a/sm/server.c
+++ b/sm/server.c
@@ -203,9 +203,25 @@ cmd_encrypt (ASSUAN_CONTEXT ctx, char *line)
static int
cmd_decrypt (ASSUAN_CONTEXT ctx, char *line)
{
-
+ CTRL ctrl = assuan_get_pointer (ctx);
+ int inp_fd, out_fd;
+ FILE *out_fp;
+ int rc;
+
+ inp_fd = assuan_get_input_fd (ctx);
+ if (inp_fd == -1)
+ return set_error (No_Input, NULL);
+ out_fd = assuan_get_output_fd (ctx);
+ if (out_fd == -1)
+ return set_error (No_Output, NULL);
- return set_error (Not_Implemented, "fixme");
+ out_fp = fdopen ( dup(out_fd), "w");
+ if (!out_fp)
+ return set_error (General_Error, "fdopen() failed");
+ rc = gpgsm_decrypt (ctrl, inp_fd, out_fp);
+ fclose (out_fp);
+
+ return rc_to_assuan_status (rc);
}
@@ -395,6 +411,7 @@ gpgsm_server (void)
assuan_strerror(rc));
gpgsm_exit (2);
}
+ assuan_set_hello_line (ctx, "GNU Privacy Guard's S/M server ready");
assuan_register_reset_notify (ctx, reset_notify);
assuan_register_input_notify (ctx, input_notify);