diff options
author | Werner Koch <[email protected]> | 2007-06-25 11:54:43 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2007-06-25 11:54:43 +0000 |
commit | 831cd76256290541a102bc660442918c95a65e6c (patch) | |
tree | c5b54be81f3530fee16f7d6ecf832a235bdba222 /sm | |
parent | Implemented the --gen-key command as we can't use the gpgsm-gencert.sh under ... (diff) | |
download | gnupg-831cd76256290541a102bc660442918c95a65e6c.tar.gz gnupg-831cd76256290541a102bc660442918c95a65e6c.zip |
Fixed a problem in estream-printf.c.
Changes for Windows (gpgsm -k does now work).
Minor cleanups.
Diffstat (limited to 'sm')
-rw-r--r-- | sm/ChangeLog | 10 | ||||
-rw-r--r-- | sm/certreqgen.c | 8 | ||||
-rw-r--r-- | sm/gpgsm.c | 16 |
3 files changed, 22 insertions, 12 deletions
diff --git a/sm/ChangeLog b/sm/ChangeLog index 737a57d0c..a57af3cfb 100644 --- a/sm/ChangeLog +++ b/sm/ChangeLog @@ -1,3 +1,13 @@ +2007-06-25 Werner Koch <[email protected]> + + * gpgsm.c (check_special_filename): Use translate_sys2libc_fd and + add new arg FOR_WRITE. Change callers to pass new arg. + +2007-06-24 Werner Koch <[email protected]> + + * gpgsm.c (open_es_fwrite): Avoid the dup by using the new + es_fdopen_nc(). + 2007-06-21 Werner Koch <[email protected]> * certreqgen-ui.c: New. diff --git a/sm/certreqgen.c b/sm/certreqgen.c index 4ffd8363e..bb30a63ec 100644 --- a/sm/certreqgen.c +++ b/sm/certreqgen.c @@ -573,8 +573,8 @@ proc_parameters (ctrl_t ctrl, if (rc) { r = get_parameter (para, pKEYTYPE, 0); - log_error (_("line %d: key generation failed: %s\n"), - r->lnr, gpg_strerror (rc)); + log_error (_("line %d: key generation failed: %s <%s>\n"), + r->lnr, gpg_strerror (rc), gpg_strsource (rc)); xfree (cardkeyid); return rc; } @@ -863,8 +863,8 @@ gpgsm_genkey (ctrl_t ctrl, int in_fd, FILE *in_stream, FILE *out_fp) rc = read_parameters (ctrl, in_fp, writer); if (rc) { - log_error ("error creating certificate request: %s\n", - gpg_strerror (rc)); + log_error ("error creating certificate request: %s <%s>\n", + gpg_strerror (rc), gpg_strsource (rc)); goto leave; } diff --git a/sm/gpgsm.c b/sm/gpgsm.c index ee6cf08cd..d3be015c7 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -481,7 +481,7 @@ static void set_cmd (enum cmd_and_opt_values *ret_cmd, enum cmd_and_opt_values new_cmd ); static void emergency_cleanup (void); -static int check_special_filename (const char *fname); +static int check_special_filename (const char *fname, int for_write); static int open_read (const char *filename); static FILE *open_fwrite (const char *filename); static estream_t open_es_fwrite (const char *filename); @@ -1732,7 +1732,7 @@ gpgsm_init_default_ctrl (struct server_control_s *ctrl) /* Check whether the filename has the form "-&nnnn", where n is a non-zero number. Returns this number or -1 if it is not the case. */ static int -check_special_filename (const char *fname) +check_special_filename (const char *fname, int for_write) { if (allow_special_filenames && fname && *fname == '-' && fname[1] == '&' ) { @@ -1742,7 +1742,7 @@ check_special_filename (const char *fname) for (i=0; isdigit (fname[i]); i++ ) ; if ( !fname[i] ) - return atoi (fname); + return translate_sys2libc_fd (atoi (fname), for_write); } return -1; } @@ -1762,7 +1762,7 @@ open_read (const char *filename) set_binary (stdin); return 0; /* stdin */ } - fd = check_special_filename (filename); + fd = check_special_filename (filename, 0); if (fd != -1) return fd; fd = open (filename, O_RDONLY | O_BINARY); @@ -1790,7 +1790,7 @@ open_fwrite (const char *filename) return stdout; } - fd = check_special_filename (filename); + fd = check_special_filename (filename, 1); if (fd != -1) { fp = fdopen (dup (fd), "wb"); @@ -1825,14 +1825,14 @@ open_es_fwrite (const char *filename) if (filename[0] == '-' && !filename[1]) { fflush (stdout); - fp = es_fdopen (dup (fileno(stdout)), "wb"); + fp = es_fdopen_nc (fileno(stdout), "wb"); return fp; } - fd = check_special_filename (filename); + fd = check_special_filename (filename, 1); if (fd != -1) { - fp = es_fdopen (dup (fd), "wb"); + fp = es_fdopen_nc (fd, "wb"); if (!fp) { log_error ("es_fdopen(%d) failed: %s\n", fd, strerror (errno)); |