[svn] GnuPG - r4542 - in trunk: agent common sm
svn author wk
cvs at cvs.gnupg.org
Mon Jul 16 11:54:17 CEST 2007
Author: wk
Date: 2007-07-16 11:53:47 +0200 (Mon, 16 Jul 2007)
New Revision: 4542
Modified:
trunk/agent/ChangeLog
trunk/agent/call-pinentry.c
trunk/agent/genkey.c
trunk/common/ChangeLog
trunk/common/estream.c
trunk/common/exechelp.c
trunk/common/simple-pwquery.c
trunk/sm/ChangeLog
trunk/sm/server.c
Log:
Properly close files opened by es_fopen.
Allow setting of an empty passphrase.
Assorted W32 changes.
Modified: trunk/agent/ChangeLog
===================================================================
--- trunk/agent/ChangeLog 2007-07-12 15:28:30 UTC (rev 4541)
+++ trunk/agent/ChangeLog 2007-07-16 09:53:47 UTC (rev 4542)
@@ -1,3 +1,10 @@
+2007-07-13 Werner Koch <wk at g10code.com>
+
+ * genkey.c (check_passphrase_constraints): Require a confirmation
+ for an empty passphrase.
+ (agent_genkey, agent_protect_and_store): No need to repeat an
+ empty passphrase.
+
2007-07-05 Werner Koch <wk at g10code.com>
* call-scd.c (struct inq_needpin_s): New.
@@ -89,7 +96,7 @@
* protect-tool.c (main) [W32]: Call pth_init.
- * preset-passphrase.c (main) [W32]: Repalce the explicit Winsocket
+ * preset-passphrase.c (main) [W32]: Replace the explicit Winsocket
init by a call to pth_init.
* trustlist.c (initialize_module_trustlist): New.
Modified: trunk/agent/call-pinentry.c
===================================================================
--- trunk/agent/call-pinentry.c 2007-07-12 15:28:30 UTC (rev 4541)
+++ trunk/agent/call-pinentry.c 2007-07-16 09:53:47 UTC (rev 4542)
@@ -206,12 +206,22 @@
if (opt.verbose)
log_info ("starting a new PIN Entry\n");
-
+
+#ifdef HAVE_W32_SYSTEM
+ fflush (stdout);
+ fflush (stderr);
+#endif
if (fflush (NULL))
{
gpg_error_t tmperr = gpg_error (gpg_err_code_from_errno (errno));
log_error ("error flushing pending output: %s\n", strerror (errno));
+ /* At least Windows XP fails here with EBADF. According to docs
+ and Wine an fflush(NULL) is the same as _flushall. However
+ the Wime implementaion does not flush stdin,stdout and stderr
+ - see above. Lets try to ignore the error. */
+#ifndef HAVE_W32_SYSTEM
return unlock_pinentry (tmperr);
+#endif
}
if (!opt.pinentry_program || !*opt.pinentry_program)
Modified: trunk/agent/genkey.c
===================================================================
--- trunk/agent/genkey.c 2007-07-12 15:28:30 UTC (rev 4541)
+++ trunk/agent/genkey.c 2007-07-16 09:53:47 UTC (rev 4542)
@@ -1,5 +1,5 @@
/* pksign.c - Generate a keypair
- * Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ * Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -102,6 +102,20 @@
return err;
}
+ if (!*pw)
+ {
+ const char *desc = _("You have not entered a passphrase - "
+ "this is in general a bad idea!%0A"
+ "Please confirm that you do not want to "
+ "have any protection on your key.");
+
+ err = agent_get_confirmation (ctrl, desc,
+ _("Yes, protection is not needed"),
+ _("Enter new passphrase"));
+ if (err)
+ return err;
+ }
+
return 0;
}
@@ -166,12 +180,15 @@
pi2->failed_tries = 0;
goto next_try;
}
- rc = agent_askpin (ctrl, text2, NULL, NULL, pi2);
- if (rc == -1)
- { /* The re-entered one did not match and the user did not
- hit cancel. */
- initial_errtext = _("does not match - try again");
- goto next_try;
+ if (pi->pin && *pi->pin)
+ {
+ rc = agent_askpin (ctrl, text2, NULL, NULL, pi2);
+ if (rc == -1)
+ { /* The re-entered one did not match and the user did not
+ hit cancel. */
+ initial_errtext = _("does not match - try again");
+ goto next_try;
+ }
}
}
if (rc)
@@ -284,12 +301,16 @@
pi2->failed_tries = 0;
goto next_try;
}
- rc = agent_askpin (ctrl, text2, NULL, NULL, pi2);
- if (rc == -1)
- { /* The re-entered one did not match and the user did not
- hit cancel. */
- initial_errtext = _("does not match - try again");
- goto next_try;
+ /* Unless the passphrase is empty, ask to confirm it. */
+ if (pi->pin && *pi->pin)
+ {
+ rc = agent_askpin (ctrl, text2, NULL, NULL, pi2);
+ if (rc == -1)
+ { /* The re-entered one did not match and the user did not
+ hit cancel. */
+ initial_errtext = _("does not match - try again");
+ goto next_try;
+ }
}
}
if (rc)
Modified: trunk/common/ChangeLog
===================================================================
--- trunk/common/ChangeLog 2007-07-12 15:28:30 UTC (rev 4541)
+++ trunk/common/ChangeLog 2007-07-16 09:53:47 UTC (rev 4542)
@@ -1,3 +1,7 @@
+2007-07-16 Werner Koch <wk at g10code.com>
+
+ * estream.c (es_func_file_create): Clear NO_CLOSE flag.
+
2007-07-12 Werner Koch <wk at g10code.com>
* sysutils.h (gnupg_fd_t): New.
Modified: trunk/common/estream.c
===================================================================
--- trunk/common/estream.c 2007-07-12 15:28:30 UTC (rev 4541)
+++ trunk/common/estream.c 2007-07-16 09:53:47 UTC (rev 4542)
@@ -861,6 +861,7 @@
#endif
file_cookie->fd = fd;
+ file_cookie->no_close = 0;
*cookie = file_cookie;
*filedes = fd;
Modified: trunk/common/exechelp.c
===================================================================
--- trunk/common/exechelp.c 2007-07-12 15:28:30 UTC (rev 4541)
+++ trunk/common/exechelp.c 2007-07-16 09:53:47 UTC (rev 4542)
@@ -358,10 +358,7 @@
if (x == -1)
log_error ("failed to translate osfhandle %p\n", (void*)rp[0] );
else
- {
- log_debug ("_open_osfhandle %p yields %d\n", (void*)fd, x );
- *statusfile = fdopen (x, "r");
- }
+ *statusfile = fdopen (x, "r");
}
if (!*statusfile)
{
Modified: trunk/common/simple-pwquery.c
===================================================================
--- trunk/common/simple-pwquery.c 2007-07-12 15:28:30 UTC (rev 4541)
+++ trunk/common/simple-pwquery.c 2007-07-16 09:53:47 UTC (rev 4542)
@@ -327,9 +327,6 @@
{
#ifdef SPWQ_USE_LOGGING
log_error ( _("malformed GPG_AGENT_INFO environment variable\n"));
- log_debug ( "a='%s'\n", infostr);
- log_debug ( "a='%s'\n", strchr ( infostr, PATHSEP_C));
- log_debug ( "a=%td\n", (p-infostr));
#endif
return SPWQ_NO_AGENT;
}
Modified: trunk/sm/ChangeLog
===================================================================
--- trunk/sm/ChangeLog 2007-07-12 15:28:30 UTC (rev 4541)
+++ trunk/sm/ChangeLog 2007-07-16 09:53:47 UTC (rev 4542)
@@ -1,3 +1,8 @@
+2007-07-16 Werner Koch <wk at g10code.com>
+
+ * server.c (cmd_message): Use gnupg_fd_t to avoid dependecy on
+ newer assuan versions.
+
2007-07-12 Werner Koch <wk at g10code.com>
* gpgsm.c (check_special_filename): Use translate_sys2libc_fd_int
Modified: trunk/sm/server.c
===================================================================
--- trunk/sm/server.c 2007-07-12 15:28:30 UTC (rev 4541)
+++ trunk/sm/server.c 2007-07-16 09:53:47 UTC (rev 4542)
@@ -734,7 +734,7 @@
cmd_message (assuan_context_t ctx, char *line)
{
int rc;
- assuan_fd_t sysfd;
+ gnupg_fd_t sysfd;
int fd;
ctrl_t ctrl = assuan_get_pointer (ctx);
More information about the Gnupg-commits
mailing list