1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-08 12:44:23 +01:00

(agent_send_all_options): Try to deduce the ttyname

from stdin.
This commit is contained in:
Werner Koch 2004-10-26 07:50:47 +00:00
parent 65077adf83
commit 3060984dd1
3 changed files with 43 additions and 5 deletions

View File

@ -1,3 +1,17 @@
2004-10-26 Werner Koch <wk@g10code.com>
* app-openpgp.c (verify_chv3): The minimum length for CHV3 is
8. Changed string to match the other ones.
* passphrase.c (agent_send_all_options): Try to deduce the ttyname
from stdin.
2004-10-22 Werner Koch <wk@g10code.com>
* card-util.c (fetch_url): Disable for gnupg 1.9
(card_generate_subkey): Ditto.
(card_store_subkey): Ditto.
2004-10-21 David Shaw <dshaw@jabberwocky.com>
* options.h, g10.c (main), mainproc.c (check_sig_and_print):

View File

@ -523,6 +523,7 @@ change_url (void)
static int
fetch_url(void)
{
#if GNUPG_MAJOR_VERSION == 1
int rc;
struct agent_card_info_s info;
@ -560,6 +561,9 @@ fetch_url(void)
log_error("no URL set on card\n");
return rc;
#else
return 0;
#endif
}
@ -577,12 +581,14 @@ change_login (const char *args)
for (args++; spacep (args); args++)
;
fp = fopen (args, "rb");
#if GNUPG_MAJOR_VERSION == 1
if (fp && is_secured_file (fileno (fp)))
{
fclose (fp);
fp = NULL;
errno = EPERM;
}
#endif
if (!fp)
{
tty_printf (_("can't open `%s': %s\n"), args, strerror (errno));
@ -839,6 +845,7 @@ restore_forced_chv1 (int *forced_chv1)
}
}
#if GNUPG_MAJOR_VERSION == 1
/* Helper for the key generation/edit functions. */
static void
show_card_key_info (struct agent_card_info_s *info)
@ -851,8 +858,9 @@ show_card_key_info (struct agent_card_info_s *info)
print_sha1_fpr (NULL, info->fpr3valid? info->fpr3:NULL);
tty_printf ("\n");
}
#endif
#if GNUPG_MAJOR_VERSION == 1
/* Helper for the key generation/edit functions. */
static int
replace_existing_key_p (struct agent_card_info_s *info, int keyno)
@ -872,7 +880,7 @@ replace_existing_key_p (struct agent_card_info_s *info, int keyno)
}
return 0;
}
#endif
static void
@ -898,7 +906,7 @@ generate_card_keys (const char *serialno)
want_backup = cpr_get_answer_is_yes
( "cardedit.genkeys.backup_enc",
_("Make off-card backup of encryption key? (Y/n) "));
#warning we need answer_is_yes_no_default()
/*FIXME: we need answer_is_yes_no_default()*/
#endif
if ( (info.fpr1valid && !fpr_is_zero (info.fpr1))
@ -928,8 +936,12 @@ generate_card_keys (const char *serialno)
if (check_pin_for_key_operation (&info, &forced_chv1))
goto leave;
#if GNUPG_MAJOR_VERSION == 1
generate_keypair (NULL, info.serialno,
want_backup? opt.homedir:NULL);
#else
generate_keypair (NULL, info.serialno);
#endif
leave:
agent_release_card_info (&info);
@ -942,6 +954,7 @@ generate_card_keys (const char *serialno)
int
card_generate_subkey (KBNODE pub_keyblock, KBNODE sec_keyblock)
{
#if GNUPG_MAJOR_VERSION == 1
struct agent_card_info_s info;
int okay = 0;
int forced_chv1 = 0;
@ -988,6 +1001,9 @@ card_generate_subkey (KBNODE pub_keyblock, KBNODE sec_keyblock)
agent_release_card_info (&info);
restore_forced_chv1 (&forced_chv1);
return okay;
#else
return 0;
#endif
}
@ -997,6 +1013,7 @@ card_generate_subkey (KBNODE pub_keyblock, KBNODE sec_keyblock)
int
card_store_subkey (KBNODE node, int use)
{
#if GNUPG_MAJOR_VERSION == 1
struct agent_card_info_s info;
int okay = 0;
int rc;
@ -1117,6 +1134,9 @@ card_store_subkey (KBNODE node, int use)
free_secret_key (copied_sk);
agent_release_card_info (&info);
return okay;
#else
return 0;
#endif
}

View File

@ -377,9 +377,13 @@ agent_send_all_options (int fd)
if (!opt.ttyname)
{
const char *tmp;
dft_ttyname = getenv ("GPG_TTY");
if ((!dft_ttyname || !*dft_ttyname) && tty_get_ttyname ())
dft_ttyname = tty_get_ttyname ();
if ((!dft_ttyname || !*dft_ttyname) && (tmp=ttyname (0)))
dft_ttyname = tmp;
if ((!dft_ttyname || !*dft_ttyname) && (tmp=tty_get_ttyname ()))
dft_ttyname = tmp;
}
if (opt.ttyname || dft_ttyname)
{