Discussion:
Gnus asking for key twice
Adam
2011-11-28 18:02:29 UTC
Permalink
Whenever I send a signed mail which has a Gcc'ed header pointing to my
archive group, I am asked to select the sign key twice - once before
connecting to my smtp server, and once after actually sending the mail.
mm-sign-option is set to guided. When there is no Gcc header, I am only
asked once.

Is this a bug or a feature?
Adam
2011-11-28 22:22:53 UTC
Permalink
Post by Adam
Whenever I send a signed mail which has a Gcc'ed header pointing to my
archive group, I am asked to select the sign key twice - once before
connecting to my smtp server, and once after actually sending the mail.
mm-sign-option is set to guided. When there is no Gcc header, I am only
asked once.
Is this a bug or a feature?
I investigated. gnus-inews-do-gcc is calling
message-encode-message-body, which internally triggers the key selection
dialogue. This looks like a real design flaw to me. Gnus should encode
the message only once, and preserve the result.
Adam
2011-11-28 22:40:18 UTC
Permalink
Post by Adam
Post by Adam
Whenever I send a signed mail which has a Gcc'ed header pointing to my
archive group, I am asked to select the sign key twice - once before
connecting to my smtp server, and once after actually sending the mail.
mm-sign-option is set to guided. When there is no Gcc header, I am only
asked once.
Is this a bug or a feature?
I investigated. gnus-inews-do-gcc is calling
message-encode-message-body, which internally triggers the key
selection dialogue. This looks like a real design flaw to me. Gnus
should encode the message only once, and preserve the result.
The easiest solution is to add a new hook. It should be called in
messages-send-mail right after the message has been dispatched to the
server, with the current buffer being the actual message buffer that has
been sent. Gnus then should add gnus-inews-do-gcc to this hook, and use
the processed buffer to save.

Do I sound reasonable? Whats a good name for such a new hook?
Katsumi Yamaoka
2011-11-29 10:00:54 UTC
Permalink
Post by Adam
Post by Adam
Post by Adam
Whenever I send a signed mail which has a Gcc'ed header pointing to my
archive group, I am asked to select the sign key twice - once before
connecting to my smtp server, and once after actually sending the mail.
mm-sign-option is set to guided. When there is no Gcc header, I am only
asked once.
Is this a bug or a feature?
I investigated. gnus-inews-do-gcc is calling
message-encode-message-body, which internally triggers the key
selection dialogue. This looks like a real design flaw to me. Gnus
should encode the message only once, and preserve the result.
The easiest solution is to add a new hook. It should be called in
messages-send-mail right after the message has been dispatched to the
server, with the current buffer being the actual message buffer that has
been sent. Gnus then should add gnus-inews-do-gcc to this hook, and use
the processed buffer to save.
Do I sound reasonable? Whats a good name for such a new hook?
A sent message and Gcc'd one are not exactly the same. AFAICT,
the Gcc header remains in a Gcc copy but is deleted in the one
sent. Maybe there are other differences besides I cannot recall.
So, we will have to verify all the message sending functions and
situations in order to make such a change, I think.

How about making the expiry time of the passphrase cache longer?
The `mml-secure-passphrase-cache-expiry' controls it; the default
value might be too short. If you want to try changing it briefly
where mml2015.elc has already been loaded, you'll need to change
`mml2015-passphrase-cache-expiry' instead (it inherits the value
of `mml-secure-passphrase-cache-expiry' as the default value).
Katsumi Yamaoka
2011-11-29 10:19:35 UTC
Permalink
AFAICT, the Gcc header remains in a Gcc copy but is deleted in the
one sent. ^^^^^^^^^^
Oops, I meant the X-Draft-From header and the like.
Adam
2011-11-29 10:56:00 UTC
Permalink
Post by Katsumi Yamaoka
How about making the expiry time of the passphrase cache longer?
The `mml-secure-passphrase-cache-expiry' controls it; the default
value might be too short. If you want to try changing it briefly
where mml2015.elc has already been loaded, you'll need to change
`mml2015-passphrase-cache-expiry' instead (it inherits the value
of `mml-secure-passphrase-cache-expiry' as the default value).
The passphrase is not the problem. In fact I do not protect my keys
with passphrases. It is the actual key (say the key that should be used
to sign the message) selection dialogue that pops up twice.
Katsumi Yamaoka
2011-11-30 11:45:37 UTC
Permalink
Post by Adam
The passphrase is not the problem. In fact I do not protect my keys
with passphrases. It is the actual key (say the key that should be used
to sign the message) selection dialogue that pops up twice.
I overlooked you wrote `mm-sign-option is set to guided', sorry.
That you are prompted twice seems to be due to a bug of
`mml2015-epg-sign'. The encrypting function might have it, too.
There are two issues in the following section:

(or (message-options-get 'mml2015-epg-signers)
(message-options-set 'mml2015-epg-signers ...))

The second line tries to save a signer to the `message-options'
variable and the first line gets it back in the next time.
However, `message-options' is always buffer-local and those are
done in a temporary buffer. So, this save-and-back plan goes
wrong.

In addition, `epa-select-keys', that passes a signer to the second
line from the selection menu, always returns nil as far as I can
observe.

It seems hard to fix.
Katsumi Yamaoka
2011-12-01 04:55:43 UTC
Permalink
Post by Katsumi Yamaoka
That you are prompted twice seems to be due to a bug of
`mml2015-epg-sign'. The encrypting function might have it, too.
(or (message-options-get 'mml2015-epg-signers)
(message-options-set 'mml2015-epg-signers ...))
The second line tries to save a signer to the `message-options'
variable and the first line gets it back in the next time.
However, `message-options' is always buffer-local and those are
done in a temporary buffer. So, this save-and-back plan goes
wrong.
Fixed. The value of `message-options' is shared between a draft
buffer and temporary working buffers now. So, a signer you once
select is kept in it and you should never be prompted for a signer
twice even if you set `mm-sign-option' to `guided'.
Post by Katsumi Yamaoka
In addition, `epa-select-keys', that passes a signer to the second
line from the selection menu, always returns nil as far as I can
observe.
I should have used the `m' key, not the mouse-2 button, to select
one.
Adam
2011-12-01 11:17:51 UTC
Permalink
Post by Katsumi Yamaoka
Post by Katsumi Yamaoka
That you are prompted twice seems to be due to a bug of
`mml2015-epg-sign'. The encrypting function might have it, too.
(or (message-options-get 'mml2015-epg-signers)
(message-options-set 'mml2015-epg-signers ...))
The second line tries to save a signer to the `message-options'
variable and the first line gets it back in the next time.
However, `message-options' is always buffer-local and those are
done in a temporary buffer. So, this save-and-back plan goes
wrong.
Fixed. The value of `message-options' is shared between a draft
buffer and temporary working buffers now. So, a signer you once
select is kept in it and you should never be prompted for a signer
twice even if you set `mm-sign-option' to `guided'.
Post by Katsumi Yamaoka
In addition, `epa-select-keys', that passes a signer to the second
line from the selection menu, always returns nil as far as I can
observe.
I should have used the `m' key, not the mouse-2 button, to select
one.
Thank you

Loading...