aboutsummaryrefslogtreecommitdiffstats
path: root/sm/server.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2002-06-25 09:34:10 +0000
committerWerner Koch <[email protected]>2002-06-25 09:34:10 +0000
commit5c5a3f689a8d96872e055d8e384a5684e4fd096c (patch)
tree0c5801d3a1e66b84788c427a69b4944b47957d9e /sm/server.c
parent* gpgsm.c, gpgsm.h: New option --debug-no-path-validation. (diff)
downloadgnupg-5c5a3f689a8d96872e055d8e384a5684e4fd096c.tar.gz
gnupg-5c5a3f689a8d96872e055d8e384a5684e4fd096c.zip
* certdump.c (print_dn_part): Always print a leading slash,
removed NEED_DELIM arg and changed caller. * export.c (gpgsm_export): Print LFs to FP and not stdout. (print_short_info): Ditto. Make use of gpgsm_print_name. * server.c (cmd_export): Use output-fd instead of data lines; this was actually the specified way.
Diffstat (limited to '')
-rw-r--r--sm/server.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/sm/server.c b/sm/server.c
index a7ae98d56..47d870d6b 100644
--- a/sm/server.c
+++ b/sm/server.c
@@ -443,12 +443,13 @@ static int
cmd_export (ASSUAN_CONTEXT ctx, char *line)
{
CTRL ctrl = assuan_get_pointer (ctx);
- FILE *fp = assuan_get_data_fp (ctx);
+ int fd = assuan_get_output_fd (ctx);
+ FILE *out_fp;
char *p;
STRLIST list, sl;
- if (!fp)
- return set_error (General_Error, "no data stream");
+ if (fd == -1)
+ return set_error (No_Output, NULL);
/* break the line down into an STRLIST */
list = NULL;
@@ -473,8 +474,20 @@ cmd_export (ASSUAN_CONTEXT ctx, char *line)
}
}
- gpgsm_export (ctrl, list, fp);
+ out_fp = fdopen ( dup(fd), "w");
+ if (!out_fp)
+ {
+ free_strlist (list);
+ return set_error (General_Error, "fdopen() failed");
+ }
+
+ gpgsm_export (ctrl, list, out_fp);
+ fclose (out_fp);
free_strlist (list);
+ /* close and reset the fd */
+ close_message_fd (ctrl);
+ assuan_close_input_fd (ctx);
+ assuan_close_output_fd (ctx);
return 0;
}