aboutsummaryrefslogtreecommitdiffstats
path: root/g10/passphrase.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2004-11-17 16:04:21 +0000
committerWerner Koch <[email protected]>2004-11-17 16:04:21 +0000
commit3220faf7f747269269f16e3d0e481178ffc3f185 (patch)
tree941b4e9cf8a0fd80980f81054f46b7a4d6509676 /g10/passphrase.c
parent* configure.ac: Autodetect wldap32 on Windoze. (diff)
downloadgnupg-3220faf7f747269269f16e3d0e481178ffc3f185.tar.gz
gnupg-3220faf7f747269269f16e3d0e481178ffc3f185.zip
(open_info_file): New.
(main): Unconditionally implement --status-file, --logger-file, --attribute-file, --passphrase-file, --command-file. This is not generally useful but easy to support and might make scripting under Windows easier.
Diffstat (limited to 'g10/passphrase.c')
-rw-r--r--g10/passphrase.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/g10/passphrase.c b/g10/passphrase.c
index c319000e5..d63ba6719 100644
--- a/g10/passphrase.c
+++ b/g10/passphrase.c
@@ -267,19 +267,20 @@ readn (int fd, void *buf, size_t buflen, size_t *ret_nread)
size_t nleft = buflen;
int nread;
char *p;
-
+
p = buf;
- while (nleft > 0)
+ while( nleft > 0 )
{
- nread = read (fd, buf, nleft);
- if (nread < 0)
+ nread = read ( fd, buf, nleft );
+ if( nread < 0 )
{
- if (nread == EINTR)
+ if (errno == EINTR)
nread = 0;
- else {
- log_error ("read() error: %s\n", strerror (errno));
- return -1;
- }
+ else
+ {
+ log_error ( "read() error: %s\n", strerror (errno) );
+ return -1;
+ }
}
else if (!nread)
break; /* EOF */
@@ -1030,6 +1031,7 @@ passphrase_clear_cache ( u32 *keyid, int algo )
*/
char *
ask_passphrase (const char *description,
+ const char *tryagain_text,
const char *promptid,
const char *prompt, int *canceled)
{
@@ -1044,7 +1046,9 @@ ask_passphrase (const char *description,
agent_died:
if ( opt.use_agent )
{
- pw = agent_get_passphrase (NULL, 0, description, canceled );
+ pw = agent_get_passphrase (NULL, 0,
+ tryagain_text? tryagain_text :description,
+ canceled );
if (!pw)
{
if (!opt.use_agent)
@@ -1063,6 +1067,8 @@ ask_passphrase (const char *description,
pw = NULL;
}
else {
+ if (tryagain_text)
+ tty_printf(_("%s.\n"), tryagain_text);
pw = cpr_get_hidden(promptid? promptid : "passphrase.ask",
prompt?prompt : _("Enter passphrase: ") );
tty_kill_prompt();
@@ -1177,7 +1183,7 @@ passphrase_to_dek( u32 *keyid, int pubkey_algo,
agent_died:
if( next_pw ) {
- /* Simply return the passpharse we already have in NEXT_PW. */
+ /* Simply return the passphrase we already have in NEXT_PW. */
pw = next_pw;
next_pw = NULL;
}