[git] GnuPG - branch, neal/next, created. gnupg-2.1.3-25-ge9f7a8d
by Neal H. Walfield
cvs at cvs.gnupg.org
Wed May 6 14:52:04 CEST 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Guard".
The branch, neal/next has been created
at e9f7a8d9dfa37c4980fec16527a3ee3db75e8c5c (commit)
- Log -----------------------------------------------------------------
commit e9f7a8d9dfa37c4980fec16527a3ee3db75e8c5c
Author: Neal H. Walfield <neal at g10code.com>
Date: Wed May 6 14:50:38 2015 +0200
agent: Or in the value; don't overwrite the variable.
* agent/call-pinentry.c (pinentry_status_cb): Or in
PINENTRY_STATUS_CLOSE_BUTTON; don't overwrite *FLAG.
--
Signed-off-by: Neal H. Walfield <neal at g10code.com>
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index d24a759..9253866 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -727,7 +727,7 @@ pinentry_status_cb (void *opaque, const char *line)
if ((args = has_leading_keyword (line, "BUTTON_INFO")))
{
if (!strcmp (args, "close"))
- *flag = PINENTRY_STATUS_CLOSE_BUTTON;
+ *flag |= PINENTRY_STATUS_CLOSE_BUTTON;
}
else if (has_leading_keyword (line, "PIN_REPEATED"))
{
commit 8a028a02411f85f6c3a2d7f407400150a5e3934d
Author: Neal H. Walfield <neal at g10code.com>
Date: Wed May 6 14:35:22 2015 +0200
agent: Avoid magic numbers. Use more accurate names.
* agent/call-pinentry.c (PINENTRY_STATUS_CLOSE_BUTTON): New constant.
(PINENTRY_STATUS_PIN_REPEATED): Likewise.
(close_button_status_cb): Rename from this...
(pinentry_status_cb): ... to this. Use the constants.
(agent_askpin): Rename local variable from close_button to
pinentry_status. Use symbolic constants rather than magic numbers.
--
Signed-off-by: Neal H. Walfield <neal at g10code.com>
diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c
index d3a0547..d24a759 100644
--- a/agent/call-pinentry.c
+++ b/agent/call-pinentry.c
@@ -710,11 +710,16 @@ setup_qualitybar (void)
return 0;
}
+enum
+ {
+ PINENTRY_STATUS_CLOSE_BUTTON = 1 << 0,
+ PINENTRY_STATUS_PIN_REPEATED = 1 << 8
+ };
/* Check the button_info line for a close action. Also check for the
PIN_REPEATED flag. */
static gpg_error_t
-close_button_status_cb (void *opaque, const char *line)
+pinentry_status_cb (void *opaque, const char *line)
{
unsigned int *flag = opaque;
const char *args;
@@ -722,11 +727,11 @@ close_button_status_cb (void *opaque, const char *line)
if ((args = has_leading_keyword (line, "BUTTON_INFO")))
{
if (!strcmp (args, "close"))
- *flag = 1;
+ *flag = PINENTRY_STATUS_CLOSE_BUTTON;
}
else if (has_leading_keyword (line, "PIN_REPEATED"))
{
- *flag |= 256;
+ *flag |= PINENTRY_STATUS_PIN_REPEATED;
}
return 0;
@@ -752,7 +757,7 @@ agent_askpin (ctrl_t ctrl,
const char *errtext = NULL;
int is_pin = 0;
int saveflag;
- unsigned int close_button;
+ unsigned int pinentry_status;
if (opt.batch)
return 0; /* fixme: we should return BAD PIN */
@@ -901,10 +906,10 @@ agent_askpin (ctrl_t ctrl,
saveflag = assuan_get_flag (entry_ctx, ASSUAN_CONFIDENTIAL);
assuan_begin_confidential (entry_ctx);
- close_button = 0;
+ pinentry_status = 0;
rc = assuan_transact (entry_ctx, "GETPIN", getpin_cb, &parm,
inq_quality, entry_ctx,
- close_button_status_cb, &close_button);
+ pinentry_status_cb, &pinentry_status);
assuan_set_flag (entry_ctx, ASSUAN_CONFIDENTIAL, saveflag);
/* Most pinentries out in the wild return the old Assuan error code
for canceled which gets translated to an assuan Cancel error and
@@ -916,7 +921,8 @@ agent_askpin (ctrl_t ctrl,
/* Change error code in case the window close button was clicked
to cancel the operation. */
- if ((close_button & 1) && gpg_err_code (rc) == GPG_ERR_CANCELED)
+ if ((pinentry_status & PINENTRY_STATUS_CLOSE_BUTTON)
+ && gpg_err_code (rc) == GPG_ERR_CANCELED)
rc = gpg_err_make (gpg_err_source (rc), GPG_ERR_FULLY_CANCELED);
if (gpg_err_code (rc) == GPG_ERR_ASS_TOO_MUCH_DATA)
@@ -954,7 +960,8 @@ agent_askpin (ctrl_t ctrl,
if (!errtext)
{
- if (pininfo->with_repeat && (close_button & 256))
+ if (pininfo->with_repeat
+ && (pinentry_status & PINENTRY_STATUS_PIN_REPEATED))
pininfo->repeat_okay = 1;
return unlock_pinentry (0); /* okay, got a PIN or passphrase */
}
@@ -978,7 +985,7 @@ agent_get_passphrase (ctrl_t ctrl,
char line[ASSUAN_LINELENGTH];
struct entry_parm_s parm;
int saveflag;
- unsigned int close_button;
+ unsigned int pinentry_status;
*retpass = NULL;
if (opt.batch)
@@ -1055,10 +1062,10 @@ agent_get_passphrase (ctrl_t ctrl,
saveflag = assuan_get_flag (entry_ctx, ASSUAN_CONFIDENTIAL);
assuan_begin_confidential (entry_ctx);
- close_button = 0;
+ pinentry_status = 0;
rc = assuan_transact (entry_ctx, "GETPIN", getpin_cb, &parm,
inq_quality, entry_ctx,
- close_button_status_cb, &close_button);
+ pinentry_status_cb, &pinentry_status);
assuan_set_flag (entry_ctx, ASSUAN_CONFIDENTIAL, saveflag);
/* Most pinentries out in the wild return the old Assuan error code
for canceled which gets translated to an assuan Cancel error and
@@ -1067,7 +1074,8 @@ agent_get_passphrase (ctrl_t ctrl,
rc = gpg_err_make (gpg_err_source (rc), GPG_ERR_CANCELED);
/* Change error code in case the window close button was clicked
to cancel the operation. */
- if ((close_button & 1) && gpg_err_code (rc) == GPG_ERR_CANCELED)
+ if ((pinentry_status & PINENTRY_STATUS_CLOSE_BUTTON)
+ && gpg_err_code (rc) == GPG_ERR_CANCELED)
rc = gpg_err_make (gpg_err_source (rc), GPG_ERR_FULLY_CANCELED);
if (rc)
-----------------------------------------------------------------------
hooks/post-receive
--
The GNU Privacy Guard
http://git.gnupg.org
More information about the Gnupg-commits
mailing list