1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-09-23 15:21:42 +02:00

sm: Fix the cases where input from stdin.

* sm/gpgsm.c (main): Fix calling gpgsm_sign with es_stdin.
Fix calling gpgsm_verify with es_stdin.
Fix calling gpgsm_decrypt with es_stdin.
* sm/import.c (gpgsm_import_files): Fix calling import_one
with es_stdin.

--

GnuPG-bug-id: 6592
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-07-13 13:41:24 +09:00
parent 3e1357789f
commit c8044c76ef
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054
2 changed files with 5 additions and 4 deletions

View File

@ -1947,7 +1947,7 @@ main ( int argc, char **argv)
signing because that is what gpg does.*/ signing because that is what gpg does.*/
set_binary (stdin); set_binary (stdin);
if (!argc) /* Create from stdin. */ if (!argc) /* Create from stdin. */
err = gpgsm_sign (&ctrl, signerlist, 0, detached_sig, fp); err = gpgsm_sign (&ctrl, signerlist, es_stdin, detached_sig, fp);
else if (argc == 1) /* From file. */ else if (argc == 1) /* From file. */
{ {
estream_t data_fp = es_fopen (*argv, "rb"); estream_t data_fp = es_fopen (*argv, "rb");
@ -2001,7 +2001,8 @@ main ( int argc, char **argv)
fp = open_es_fwrite (opt.outfile); fp = open_es_fwrite (opt.outfile);
if (!argc) if (!argc)
gpgsm_verify (&ctrl, 0, NULL, fp); /* normal signature from stdin */ /* normal signature from stdin */
gpgsm_verify (&ctrl, es_stdin, NULL, fp);
else if (argc == 1) else if (argc == 1)
{ {
estream_t in_fp = es_fopen (*argv, "rb"); estream_t in_fp = es_fopen (*argv, "rb");
@ -2050,7 +2051,7 @@ main ( int argc, char **argv)
set_binary (stdin); set_binary (stdin);
if (!argc) if (!argc)
err = gpgsm_decrypt (&ctrl, 0, fp); /* from stdin */ err = gpgsm_decrypt (&ctrl, es_stdin, fp); /* from stdin */
else if (argc == 1) else if (argc == 1)
{ {
estream_t data_fp = es_fopen (*argv, "rb"); estream_t data_fp = es_fopen (*argv, "rb");

View File

@ -524,7 +524,7 @@ gpgsm_import_files (ctrl_t ctrl, int nfiles, char **files,
memset (&stats, 0, sizeof stats); memset (&stats, 0, sizeof stats);
if (!nfiles) if (!nfiles)
rc = import_one (ctrl, &stats, 0); rc = import_one (ctrl, &stats, es_stdin);
else else
{ {
for (; nfiles && !rc ; nfiles--, files++) for (; nfiles && !rc ; nfiles--, files++)