diff options
author | Werner Koch <wk@gnupg.org> | 2002-06-25 11:34:10 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2002-06-25 11:34:10 +0200 |
commit | 5c5a3f689a8d96872e055d8e384a5684e4fd096c (patch) | |
tree | 0c5801d3a1e66b84788c427a69b4944b47957d9e | |
parent | * gpgsm.c, gpgsm.h: New option --debug-no-path-validation. (diff) | |
download | gnupg2-5c5a3f689a8d96872e055d8e384a5684e4fd096c.tar.xz gnupg2-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.
-rw-r--r-- | sm/ChangeLog | 14 | ||||
-rw-r--r-- | sm/certdump.c | 24 | ||||
-rw-r--r-- | sm/export.c | 42 | ||||
-rw-r--r-- | sm/gpgsm.c | 1 | ||||
-rw-r--r-- | sm/server.c | 21 |
5 files changed, 53 insertions, 49 deletions
diff --git a/sm/ChangeLog b/sm/ChangeLog index 237365847..36bbbb335 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,6 +1,20 @@ +2002-06-25 Werner Koch <wk@gnupg.org> + + * 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. + 2002-06-24 Werner Koch <wk@gnupg.org> + * gpgsm.c: Removed duped help entry for --list-keys. + * gpgsm.c, gpgsm.h: New option --debug-no-path-validation. + * certpath.c (gpgsm_validate_path): Use it here instead of the debug flag hack. diff --git a/sm/certdump.c b/sm/certdump.c index 11e9f659f..dfd4e330e 100644 --- a/sm/certdump.c +++ b/sm/certdump.c @@ -364,9 +364,8 @@ parse_dn (const unsigned char *string) } -static int -print_dn_part (FILE *fp, struct dn_array_s *dn, const char *key, - int need_delim) +static void +print_dn_part (FILE *fp, struct dn_array_s *dn, const char *key) { int any = 0; @@ -374,11 +373,7 @@ print_dn_part (FILE *fp, struct dn_array_s *dn, const char *key, { if (!strcmp (dn->key, key) && dn->value && *dn->value) { - if (need_delim) - { - putc ('/', fp); - need_delim = 0; - } + putc ('/', fp); if (any) fputs (" + ", fp); else @@ -387,7 +382,6 @@ print_dn_part (FILE *fp, struct dn_array_s *dn, const char *key, any = 1; } } - return any; } /* Print all parts of a DN in a "standard" sequence. We first print @@ -398,13 +392,10 @@ print_dn_parts (FILE *fp, struct dn_array_s *dn) const char *stdpart[] = { "CN", "OU", "O", "STREET", "L", "ST", "C", "EMail", NULL }; - int any=0, i; + int i; for (i=0; stdpart[i]; i++) - { - if (print_dn_part (fp, dn, stdpart[i], any)) - any = 1; - } + print_dn_part (fp, dn, stdpart[i]); /* now print the rest without any specific ordering */ for (; dn->key; dn++) @@ -415,10 +406,7 @@ print_dn_parts (FILE *fp, struct dn_array_s *dn) break; } if (!stdpart[i]) - { - if (print_dn_part (fp, dn, dn->key, any)) - any = 1; - } + print_dn_part (fp, dn, dn->key); } } diff --git a/sm/export.c b/sm/export.c index fc82b7e6c..042850752 100644 --- a/sm/export.c +++ b/sm/export.c @@ -136,7 +136,7 @@ gpgsm_export (CTRL ctrl, STRLIST names, FILE *fp) if (count) putc ('\n', fp); print_short_info (cert, fp); - putc ('\n', stdout); + putc ('\n', fp); } count++; @@ -202,20 +202,14 @@ print_short_info (KsbaCert cert, FILE *fp) KsbaSexp sexp; int idx; - fputs ("Issuer ...: ", fp); - p = ksba_cert_get_issuer (cert, 0); - if (p) + for (idx=0; (p = ksba_cert_get_issuer (cert, idx)); idx++) { - print_sanitized_string (fp, p, '\n'); + fputs (!idx? "Issuer ...: " + : "\n aka ...: ", fp); + gpgsm_print_name (fp, p); xfree (p); - for (idx=1; (p = ksba_cert_get_issuer (cert, idx)); idx++) - { - fputs ("\n aka ...: ", fp); - print_sanitized_string (fp, p, '\n'); - xfree (p); - } } - putc ('\n', stdout); + putc ('\n', fp); fputs ("Serial ...: ", fp); sexp = ksba_cert_get_serial (cert); @@ -235,24 +229,20 @@ print_short_info (KsbaCert cert, FILE *fp) } xfree (sexp); } - putc ('\n', stdout); + putc ('\n', fp); - fputs ("Subject ..: ", fp); - p = ksba_cert_get_subject (cert, 0); - if (p) + for (idx=0; (p = ksba_cert_get_subject (cert, idx)); idx++) { - print_sanitized_string (fp, p, '\n'); + fputs (!idx? "Subject ..: " + : "\n aka ..: ", fp); + gpgsm_print_name (fp, p); xfree (p); - for (idx=1; (p = ksba_cert_get_subject (cert, idx)); idx++) - { - fputs ("\n aka ..: ", fp); - print_sanitized_string (fp, p, '\n'); - xfree (p); - } } - else - fputs ("none", fp); - putc ('\n', stdout); + putc ('\n', fp); } + + + + diff --git a/sm/gpgsm.c b/sm/gpgsm.c index 9fe3205cb..0754d3a57 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -214,7 +214,6 @@ static ARGPARSE_OPTS opts[] = { { aVerify, "verify" , 256, N_("verify a signature")}, { aVerifyFiles, "verify-files" , 256, "@" }, { aListKeys, "list-keys", 256, N_("list keys")}, - { aListKeys, "list-keys", 256, N_("list keys")}, { aListExternalKeys, "list-external-keys", 256, N_("list external keys")}, { aListSecretKeys, "list-secret-keys", 256, N_("list secret keys")}, { aListSigs, "list-sigs", 256, N_("list certificate chain")}, 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; } |