gnupg (9 files)
cvs user wk
cvs at cvs.gnupg.org
Wed Nov 17 16:58:20 CET 2004
Date: Wednesday, November 17, 2004 @ 17:04:21
Author: wk
Path: /cvs/gnupg/gnupg
Modified: AUTHORS ChangeLog README g10/ChangeLog g10/app-openpgp.c
g10/cardglue.c g10/g10.c g10/keydb.h g10/passphrase.c
(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.
-------------------+
AUTHORS | 2
ChangeLog | 5 ++
README | 2
g10/ChangeLog | 28 ++++++++++++-
g10/app-openpgp.c | 45 ++++++++++++---------
g10/cardglue.c | 93 ++++++++++++++++++++++++++++++++++++++-----
g10/g10.c | 110 ++++++++++++++++++++++++++++++++--------------------
g10/keydb.h | 4 +
g10/passphrase.c | 28 ++++++++-----
9 files changed, 229 insertions(+), 88 deletions(-)
Index: gnupg/AUTHORS
diff -u gnupg/AUTHORS:1.36 gnupg/AUTHORS:1.37
--- gnupg/AUTHORS:1.36 Thu Oct 21 18:56:22 2004
+++ gnupg/AUTHORS Wed Nov 17 17:04:21 2004
@@ -9,7 +9,7 @@
Birger Langkjer <birger.langkjer at image.dk> Translations [da]
-Britov Ivanovich <maxbritov at tut.by> Translations [ru]
+Maxim Britov <maxbritov at tut.by> Translations [ru]
Daniel Resare <daniel at resare.com> Translations [sv]
Index: gnupg/ChangeLog
diff -u gnupg/ChangeLog:1.220 gnupg/ChangeLog:1.221
--- gnupg/ChangeLog:1.220 Sat Nov 6 14:18:13 2004
+++ gnupg/ChangeLog Wed Nov 17 17:04:21 2004
@@ -7,6 +7,11 @@
* README, configure.ac: Add --enable-backsigs to enable the
experimental backsigs code.
+2004-11-04 Werner Koch <wk at g10code.com>
+
+ * AUTHORS: Use Maxim Britov. I am not that accustomed to the
+ Russian way of writing names.
+
2004-10-28 Werner Koch <wk at g10code.com>
Released 1.3.92.
Index: gnupg/README
diff -u gnupg/README:1.89 gnupg/README:1.90
--- gnupg/README:1.89 Fri Nov 5 04:45:06 2004
+++ gnupg/README Wed Nov 17 17:04:21 2004
@@ -603,7 +603,7 @@
--enable-selinux-support
This prevents access to certain files and won't
- allow import or export of secret keys.
+ allow import or export of secret keys.
--disable-gnupg-iconv
If iconv is available it is used to convert
Index: gnupg/g10/ChangeLog
diff -u gnupg/g10/ChangeLog:1.638 gnupg/g10/ChangeLog:1.639
--- gnupg/g10/ChangeLog:1.638 Thu Nov 4 23:28:39 2004
+++ gnupg/g10/ChangeLog Wed Nov 17 17:04:21 2004
@@ -1,3 +1,27 @@
+2004-11-17 Werner Koch <wk at g10code.com>
+
+ * g10.c (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.
+
+2004-11-11 Werner Koch <wk at g10code.com>
+
+ * passphrase.c (readn): Fixed test against EINTR.
+
+2004-11-05 Werner Koch <wk at g10code.com>
+
+ * app-openpgp.c: Made more strings translatable.
+ (verify_chv3, do_change_pin): Add a special prefix to the prompt
+ of the Admin PIN prompts.
+ * passphrase.c (ask_passphrase): Add arg TRYAGAIN_TEXT. Changed
+ call callers.
+ * cardglue.c (pin_cb): Make use of the OPAQUE arg to pass
+ arguments to the PIN callback. Use this to implement a way to
+ check for correct PIN repetition. Changed all callers to pass an
+ opaque argument. Improved detection of Admin PIN prompts.
+
2004-11-04 David Shaw <dshaw at jabberwocky.com>
* plaintext.c (handle_plaintext): Don't try and create a
@@ -20,9 +44,9 @@
2004-11-03 Timo Schulz <twoaday at g10code.com>
- * passphrase.c (readn, writen): Use w32_strerror instead
+ * passphrase.c (readn, writen): Use w32_strerror instead
of just showing the error number.
- * misc.c [_WIN32]: Fix warning about missing prototypes.
+ * misc.c [_WIN32]: Fix warning about missing prototypes.
2004-10-28 David Shaw <dshaw at jabberwocky.com>
Index: gnupg/g10/app-openpgp.c
diff -u gnupg/g10/app-openpgp.c:1.19 gnupg/g10/app-openpgp.c:1.20
--- gnupg/g10/app-openpgp.c:1.19 Tue Oct 26 09:51:15 2004
+++ gnupg/g10/app-openpgp.c Wed Nov 17 17:04:21 2004
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: app-openpgp.c,v 1.19 2004/10/26 07:51:15 wk Exp $
+ * $Id: app-openpgp.c,v 1.20 2004/11/17 16:04:21 wk Exp $
*/
#include <config.h>
@@ -815,7 +815,10 @@
" is permanently locked\n"), value[6]);
xfree (relptr);
- rc = pincb (pincb_arg, _("Admin PIN"), &pinvalue);
+ /* Note to translators: Do not translate the "|A|" prefix but
+ keep it at the start of the string. We need this elsewhere
+ to get some infos on the string. */
+ rc = pincb (pincb_arg, _("|A|Admin PIN"), &pinvalue);
if (rc)
{
log_info (_("PIN callback returned error: %s\n"), gpg_strerror (rc));
@@ -953,10 +956,14 @@
else
app->did_chv1 = app->did_chv2 = 0;
- rc = pincb (pincb_arg, chvno == 3? "New Admin PIN" : "New PIN", &pinvalue);
+ /* Note to translators: Do not translate the "|A|" prefix but
+ keep it at the start of the string. We need this elsewhere
+ to get some infos on the string. */
+ rc = pincb (pincb_arg, chvno == 3? _("|A|New Admin PIN") : _("New PIN"),
+ &pinvalue);
if (rc)
{
- log_error ("error getting new PIN: %s\n", gpg_strerror (rc));
+ log_error (_("error getting new PIN: %s\n"), gpg_strerror (rc));
goto leave;
}
@@ -1022,14 +1029,14 @@
rc = iso7816_get_data (app->slot, 0x006E, &buffer, &buflen);
if (rc)
{
- log_error ("error reading application data\n");
+ log_error (_("error reading application data\n"));
return gpg_error (GPG_ERR_GENERAL);
}
fpr = find_tlv (buffer, buflen, 0x00C5, &n);
if (!fpr || n != 60)
{
rc = gpg_error (GPG_ERR_GENERAL);
- log_error ("error reading fingerprint DO\n");
+ log_error (_("error reading fingerprint DO\n"));
goto leave;
}
fpr += 20*keyno;
@@ -1038,13 +1045,13 @@
if (i!=20 && !force)
{
rc = gpg_error (GPG_ERR_EEXIST);
- log_error ("key already exists\n");
+ log_error (_("key already exists\n"));
goto leave;
}
else if (i!=20)
- log_info ("existing key will be replaced\n");
+ log_info (_("existing key will be replaced\n"));
else
- log_info ("generating new key\n");
+ log_info (_("generating new key\n"));
rc = verify_chv3 (app, pincb, pincb_arg);
@@ -1054,7 +1061,7 @@
xfree (buffer); buffer = NULL;
#if 1
- log_info ("please wait while key is being generated ...\n");
+ log_info (_("please wait while key is being generated ...\n"));
start_at = time (NULL);
rc = iso7816_generate_keypair
#else
@@ -1069,16 +1076,16 @@
if (rc)
{
rc = gpg_error (GPG_ERR_CARD);
- log_error ("generating key failed\n");
+ log_error (_("generating key failed\n"));
goto leave;
}
- log_info ("key generation completed (%d seconds)\n",
+ log_info (_("key generation completed (%d seconds)\n"),
(int)(time (NULL) - start_at));
keydata = find_tlv (buffer, buflen, 0x7F49, &keydatalen);
if (!keydata)
{
rc = gpg_error (GPG_ERR_CARD);
- log_error ("response does not contain the public key data\n");
+ log_error (_("response does not contain the public key data\n"));
goto leave;
}
@@ -1086,7 +1093,7 @@
if (!m)
{
rc = gpg_error (GPG_ERR_CARD);
- log_error ("response does not contain the RSA modulus\n");
+ log_error (_("response does not contain the RSA modulus\n"));
goto leave;
}
/* log_printhex ("RSA n:", m, mlen); */
@@ -1096,7 +1103,7 @@
if (!e)
{
rc = gpg_error (GPG_ERR_CARD);
- log_error ("response does not contain the RSA public exponent\n");
+ log_error (_("response does not contain the RSA public exponent\n"));
goto leave;
}
/* log_printhex ("RSA e:", e, elen); */
@@ -1129,7 +1136,7 @@
ul = (value[0] << 16) | (value[1] << 8) | value[2];
else
{
- log_error ("invalid structure of OpenPGP card (DO 0x93)\n");
+ log_error (_("invalid structure of OpenPGP card (DO 0x93)\n"));
ul = 0;
}
return ul;
@@ -1164,14 +1171,14 @@
rc = get_cached_data (app, 0x006E, &buffer, &buflen);
if (rc)
{
- log_error ("error reading application data\n");
+ log_error (_("error reading application data\n"));
return gpg_error (GPG_ERR_GENERAL);
}
fpr = find_tlv (buffer, buflen, 0x00C5, &n);
if (!fpr || n != 60)
{
xfree (buffer);
- log_error ("error reading fingerprint DO\n");
+ log_error (_("error reading fingerprint DO\n"));
return gpg_error (GPG_ERR_GENERAL);
}
fpr += (keyno-1)*20;
@@ -1290,7 +1297,7 @@
memcpy (data+15, indata, indatalen);
sigcount = get_sig_counter (app);
- log_info ("signatures created so far: %lu\n", sigcount);
+ log_info (_("signatures created so far: %lu\n"), sigcount);
if (!app->did_chv1 || app->force_chv1 )
{
Index: gnupg/g10/cardglue.c
diff -u gnupg/g10/cardglue.c:1.18 gnupg/g10/cardglue.c:1.19
--- gnupg/g10/cardglue.c:1.18 Fri Oct 15 15:16:57 2004
+++ gnupg/g10/cardglue.c Wed Nov 17 17:04:21 2004
@@ -49,6 +49,12 @@
};
+struct pin_cb_info_s
+{
+ int repeat;
+};
+
+
static char *default_reader_port;
static APP current_app;
@@ -620,28 +626,69 @@
static int
pin_cb (void *opaque, const char *info, char **retstr)
{
+ struct pin_cb_info_s *parm = opaque;
char *value;
int canceled;
- int isadmin = (info && strstr (info, "dmin"));
-
+ int isadmin = 0;
+ const char *again_text = NULL;
*retstr = NULL;
log_debug ("asking for PIN '%s'\n", info);
+ /* We use a special prefix to check whether the Admin PIN has been
+ requested. */
+ if (info && !strncmp (info, "|A|", 3))
+ {
+ isadmin = 1;
+ info += 3;
+ }
+
+ again:
if (is_status_enabled())
write_status_text (STATUS_NEED_PASSPHRASE_PIN,
isadmin? "OPENPGP 3" : "OPENPGP 1");
- value = ask_passphrase (info,
+ value = ask_passphrase (info, again_text,
isadmin? "passphrase.adminpin.ask"
: "passphrase.pin.ask",
- isadmin? _("Enter Admin PIN: ") : _("Enter PIN: "),
+ isadmin? _("Enter Admin PIN: ")
+ : _("Enter PIN: "),
&canceled);
+ again_text = NULL;
if (!value && canceled)
return -1;
else if (!value)
return G10ERR_GENERAL;
+ if (parm->repeat)
+ {
+ char *value2;
+
+ value2 = ask_passphrase (info, NULL,
+ "passphrase.pin.repeat",
+ _("Repeat this PIN: "),
+ &canceled);
+ if (!value && canceled)
+ {
+ xfree (value);
+ return -1;
+ }
+ else if (!value)
+ {
+ xfree (value);
+ return G10ERR_GENERAL;
+ }
+ if (strcmp (value, value2))
+ {
+ again_text = N_("PIN not correctly repeated; try again");
+ xfree (value2);
+ xfree (value);
+ value = NULL;
+ goto again;
+ }
+ xfree (value2);
+ }
+
*retstr = value;
return 0;
}
@@ -654,12 +701,15 @@
const unsigned char *value, size_t valuelen)
{
APP app;
+ struct pin_cb_info_s parm;
+
+ memset (&parm, 0, sizeof parm);
app = current_app? current_app : open_card ();
if (!app)
return gpg_error (GPG_ERR_CARD);
- return app->fnc.setattr (app, name, pin_cb, NULL, value, valuelen);
+ return app->fnc.setattr (app, name, pin_cb, &parm, value, valuelen);
}
@@ -670,7 +720,7 @@
const char *keyword = line;
int keywordlen;
- log_debug ("got status line `%s'\n", line);
+/* log_debug ("got status line `%s'\n", line); */
for (keywordlen=0; *line && !spacep (line); line++, keywordlen++)
;
while (spacep (line))
@@ -722,6 +772,9 @@
APP app;
char keynostr[20];
struct ctrl_ctx_s ctrl;
+ struct pin_cb_info_s parm;
+
+ memset (&parm, 0, sizeof parm);
app = current_app? current_app : open_card ();
if (!app)
@@ -734,7 +787,7 @@
return app->fnc.genkey (app, &ctrl, keynostr,
force? 1:0,
- pin_cb, NULL);
+ pin_cb, &parm);
}
/* Send a PKSIGN command to the SCdaemon. */
@@ -745,6 +798,9 @@
{
APP app;
int rc;
+ struct pin_cb_info_s parm;
+
+ memset (&parm, 0, sizeof parm);
*r_buf = NULL;
*r_buflen = 0;
@@ -761,7 +817,7 @@
return rc;
return app->fnc.sign (app, serialno, hashalgo,
- pin_cb, NULL,
+ pin_cb, &parm,
indata, indatalen,
r_buf, r_buflen);
}
@@ -775,6 +831,9 @@
{
APP app;
int rc;
+ struct pin_cb_info_s parm;
+
+ memset (&parm, 0, sizeof parm);
*r_buf = NULL;
*r_buflen = 0;
@@ -791,7 +850,7 @@
return rc;
return app->fnc.decipher (app, serialno,
- pin_cb, NULL,
+ pin_cb, &parm,
indata, indatalen,
r_buf, r_buflen);
}
@@ -803,6 +862,10 @@
APP app;
char chvnostr[20];
int reset = 0;
+ struct pin_cb_info_s parm;
+
+ memset (&parm, 0, sizeof parm);
+ parm.repeat = 1;
reset = (chvno >= 100);
chvno %= 100;
@@ -813,7 +876,7 @@
sprintf (chvnostr, "%d", chvno);
return app->fnc.change_pin (app, NULL, chvnostr, reset,
- pin_cb, NULL);
+ pin_cb, &parm);
}
/* Perform a CHECKPIN operation. SERIALNO should be the serial
@@ -823,12 +886,15 @@
agent_scd_checkpin (const char *serialnobuf)
{
APP app;
+ struct pin_cb_info_s parm;
+
+ memset (&parm, 0, sizeof parm);
app = current_app? current_app : open_card ();
if (!app)
return gpg_error (GPG_ERR_CARD);
- return app->fnc.check_pin (app, serialnobuf, pin_cb, NULL);
+ return app->fnc.check_pin (app, serialnobuf, pin_cb, &parm);
}
@@ -841,6 +907,9 @@
const unsigned char *e, size_t elen)
{
APP app;
+ struct pin_cb_info_s parm;
+
+ memset (&parm, 0, sizeof parm);
app = current_app? current_app : open_card ();
if (!app)
@@ -848,5 +917,5 @@
return app_openpgp_storekey (app, keyno, template, template_len,
created_at, m, mlen, e, elen,
- pin_cb, NULL);
+ pin_cb, &parm);
}
Index: gnupg/g10/g10.c
diff -u gnupg/g10/g10.c:1.287 gnupg/g10/g10.c:1.288
--- gnupg/g10/g10.c:1.287 Thu Oct 21 21:18:47 2004
+++ gnupg/g10/g10.c Wed Nov 17 17:04:21 2004
@@ -33,6 +33,7 @@
#ifdef HAVE_STAT
#include <sys/stat.h> /* for stat() */
#endif
+#include <fcntl.h>
#define INCLUDED_BY_MAIN_MODULE 1
#include "packet.h"
@@ -57,6 +58,12 @@
#include "ccid-driver.h"
#endif
+#if defined(HAVE_DOSISH_SYSTEM) || defined(__CYGWIN__)
+#define MY_O_BINARY O_BINARY
+#else
+#define MY_O_BINARY 0
+#endif
+
enum cmd_and_opt_values
@@ -174,13 +181,9 @@
oDebugAll,
oDebugCCIDDriver,
oStatusFD,
-#ifdef __riscos__
oStatusFile,
-#endif /* __riscos__ */
oAttributeFD,
-#ifdef __riscos__
oAttributeFile,
-#endif /* __riscos__ */
oSKComments,
oNoSKComments,
oEmitVersion,
@@ -205,13 +208,9 @@
oBZ2CompressLevel,
oBZ2DecompressLowmem,
oPasswdFD,
-#ifdef __riscos__
oPasswdFile,
-#endif /* __riscos__ */
oCommandFD,
-#ifdef __riscos__
oCommandFile,
-#endif /* __riscos__ */
oQuickRandom,
oNoVerbose,
oTrustDBName,
@@ -284,9 +283,7 @@
oHiddenEncryptTo,
oNoEncryptTo,
oLoggerFD,
-#ifdef __riscos__
oLoggerFile,
-#endif /* __riscos__ */
oUtf8Strings,
oNoUtf8Strings,
oDisableCipherAlgo,
@@ -487,13 +484,9 @@
{ oDebug, "debug" ,4|16, "@"},
{ oDebugAll, "debug-all" ,0, "@"},
{ oStatusFD, "status-fd" ,1, "@"},
-#ifdef __riscos__
{ oStatusFile, "status-file" ,2, "@"},
-#endif /* __riscos__ */
{ oAttributeFD, "attribute-fd" ,1, "@" },
-#ifdef __riscos__
{ oAttributeFile, "attribute-file" ,2, "@" },
-#endif /* __riscos__ */
{ oNoSKComments, "no-sk-comments", 0, "@"},
{ oSKComments, "sk-comments", 0, "@"},
{ oCompletesNeeded, "completes-needed", 1, "@"},
@@ -554,17 +547,13 @@
{ aPipeMode, "pipemode", 0, "@" },
{ oKOption, NULL, 0, "@"},
{ oPasswdFD, "passphrase-fd",1, "@" },
-#ifdef __riscos__
{ oPasswdFile, "passphrase-file",2, "@" },
-#endif /* __riscos__ */
{ oCommandFD, "command-fd",1, "@" },
-#ifdef __riscos__
{ oCommandFile, "command-file",2, "@" },
-#endif /* __riscos__ */
{ oQuickRandom, "quick-random", 0, "@"},
{ oNoVerbose, "no-verbose", 0, "@"},
{ oTrustDBName, "trustdb-name", 2, "@" },
- { oNoSecmemWarn, "no-secmem-warning", 0, "@" }, /* used only by regression tests */
+ { oNoSecmemWarn, "no-secmem-warning", 0, "@" },
{ oNoPermissionWarn, "no-permission-warning", 0, "@" },
{ oNoMDCWarn, "no-mdc-warning", 0, "@" },
{ oNoArmor, "no-armor", 0, "@"},
@@ -613,9 +602,7 @@
{ oLockMultiple, "lock-multiple", 0, "@" },
{ oLockNever, "lock-never", 0, "@" },
{ oLoggerFD, "logger-fd",1, "@" },
-#ifdef __riscos__
{ oLoggerFile, "logger-file",2, "@" },
-#endif /* __riscos__ */
{ oUseEmbeddedFilename, "use-embedded-filename", 0, "@" },
{ oNoUseEmbeddedFilename, "no-use-embedded-filename", 0, "@" },
{ oUtf8Strings, "utf8-strings", 0, "@" },
@@ -930,6 +917,51 @@
}
+/* Helper to open a file FNAME either for reading or writing to be
+ used with --status-file etc functions. Not generally useful but it
+ avoids the riscos specific functions and well some Windows people
+ might like it too. Prints an error message and returns -1 on
+ error. On success the file descriptor is returned. */
+static int
+open_info_file (const char *fname, int for_write)
+{
+#ifdef __riscos__
+ return riscos_fdopenfile (fname, for_write);
+#elif defined (ENABLE_SELINUX_HACKS)
+ /* We can't allow these even when testing for a secured filename
+ because files to be secured might not yet been secured. This is
+ similar to the option file but in that case it is unlikely that
+ sensitive information may be retrieved by means of error
+ messages. */
+ return -1;
+#else
+ int fd;
+
+/* if (is_secured_filename (fname)) */
+/* { */
+/* fd = -1; */
+/* errno = EPERM; */
+/* } */
+/* else */
+/* { */
+ do
+ {
+ if (for_write)
+ fd = open (fname, O_CREAT | O_TRUNC | O_WRONLY,
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
+ else
+ fd = open (fname, O_RDONLY | MY_O_BINARY);
+ }
+ while (fd == -1 && errno == EINTR);
+/* } */
+ if ( fd == -1)
+ log_error ( for_write? _("can't create `%s': %s\n")
+ : _("can't open `%s': %s\n"), fname, strerror(errno));
+
+ return fd;
+#endif
+}
+
static void
set_cmd( enum cmd_and_opt_values *ret_cmd, enum cmd_and_opt_values new_cmd )
{
@@ -1950,34 +1982,30 @@
case oStatusFD:
set_status_fd( iobuf_translate_file_handle (pargs.r.ret_int, 1) );
break;
-#ifdef __riscos__
case oStatusFile:
- set_status_fd( iobuf_translate_file_handle ( riscos_fdopenfile (pargs.r.ret_str, 1), 1) );
+ set_status_fd ( open_info_file (pargs.r.ret_str, 1) );
break;
-#endif /* __riscos__ */
case oAttributeFD:
set_attrib_fd(iobuf_translate_file_handle (pargs.r.ret_int, 1));
break;
-#ifdef __riscos__
case oAttributeFile:
- set_attrib_fd(iobuf_translate_file_handle ( riscos_fdopenfile (pargs.r.ret_str, 1), 1) );
+ set_attrib_fd ( open_info_file (pargs.r.ret_str, 1) );
break;
-#endif /* __riscos__ */
case oLoggerFD:
log_set_logfile( NULL,
- iobuf_translate_file_handle (pargs.r.ret_int, 1) );
+ iobuf_translate_file_handle (pargs.r.ret_int, 1));
break;
-#ifdef __riscos__
case oLoggerFile:
- log_set_logfile( NULL,
- iobuf_translate_file_handle ( riscos_fdopenfile (pargs.r.ret_str, 1), 1) );
+ log_set_logfile( NULL, open_info_file (pargs.r.ret_str, 1) );
break;
-#endif /* __riscos__ */
+
case oWithFingerprint:
opt.with_fingerprint = 1;
with_fpr=1; /*fall thru*/
case oFingerprint: opt.fingerprint++; break;
- case oSecretKeyring: append_to_strlist( &sec_nrings, pargs.r.ret_str); break;
+ case oSecretKeyring:
+ append_to_strlist( &sec_nrings, pargs.r.ret_str);
+ break;
case oOptions:
/* config files may not be nested (silently ignore them) */
if( !configfp ) {
@@ -2212,21 +2240,21 @@
pwfd = iobuf_translate_file_handle (pargs.r.ret_int, 0);
opt.use_agent = 0;
break;
-#ifdef __riscos__
case oPasswdFile:
- pwfd = iobuf_translate_file_handle ( riscos_fdopenfile (pargs.r.ret_str, 0), 0);
+ pwfd = open_info_file (pargs.r.ret_str, 0);
break;
-#endif /* __riscos__ */
case oCommandFD:
opt.command_fd = iobuf_translate_file_handle (pargs.r.ret_int, 0);
break;
-#ifdef __riscos__
case oCommandFile:
- opt.command_fd = iobuf_translate_file_handle ( riscos_fdopenfile (pargs.r.ret_str, 0), 0);
+ opt.command_fd = open_info_file (pargs.r.ret_str, 0);
+ break;
+ case oCipherAlgo:
+ def_cipher_string = m_strdup(pargs.r.ret_str);
+ break;
+ case oDigestAlgo:
+ def_digest_string = m_strdup(pargs.r.ret_str);
break;
-#endif /* __riscos__ */
- case oCipherAlgo: def_cipher_string = m_strdup(pargs.r.ret_str); break;
- case oDigestAlgo: def_digest_string = m_strdup(pargs.r.ret_str); break;
case oCompressAlgo:
/* If it is all digits, stick a Z in front of it for
later. This is for backwards compatibility with
Index: gnupg/g10/keydb.h
diff -u gnupg/g10/keydb.h:1.86 gnupg/g10/keydb.h:1.87
--- gnupg/g10/keydb.h:1.86 Thu Sep 23 15:32:30 2004
+++ gnupg/g10/keydb.h Wed Nov 17 17:04:21 2004
@@ -187,7 +187,9 @@
int have_static_passphrase(void);
void read_passphrase_from_fd( int fd );
void passphrase_clear_cache ( u32 *keyid, int algo );
-char *ask_passphrase (const char *description, const char *promptid,
+char *ask_passphrase (const char *description,
+ const char *tryagain_text,
+ const char *promptid,
const char *prompt, int *canceled);
DEK *passphrase_to_dek( u32 *keyid, int pubkey_algo,
int cipher_algo, STRING2KEY *s2k, int mode,
Index: gnupg/g10/passphrase.c
diff -u gnupg/g10/passphrase.c:1.68 gnupg/g10/passphrase.c:1.69
--- gnupg/g10/passphrase.c:1.68 Wed Nov 3 21:03:46 2004
+++ gnupg/g10/passphrase.c Wed Nov 17 17:04:21 2004
@@ -267,19 +267,20 @@
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 @@
*/
char *
ask_passphrase (const char *description,
+ const char *tryagain_text,
const char *promptid,
const char *prompt, int *canceled)
{
@@ -1044,7 +1046,9 @@
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 @@
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 @@
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;
}
More information about the Gnupg-commits
mailing list