Hello,
trondd <[email protected]> wrote:
|Steffen Nurpmeso <[email protected]> wrote:
|> I'll release an update subminor v14.7.11 when you report back that
|> the issue is now fixed on [master].
|>
|> Thanks for reporting once again!
|> Ciao,
|>
|> --steffen
|
|Same issue still exists. Error output and stack track looked the same.
Naaaah -- that should really be impossible now!?
But i am truly very sorry for not going into any detail and being
so brief! Some background on what actually was wrong can be seen
in the commit message from [master] that credits you:
imap.c:_imap_getcred(): save away value storage (Tim)..
Boing Boom Tschak.
The variable storage still returns non-constant storage even
though the values are effectively constant and managed internally.
An attempt to change the return values failed, i think in 2014.
But anyway: if you want to restore some queried value setting
later with intervening changes on the key's value as stored then
you have to save away the value, which yet was desperately
missing.
Many thanks to Tim for continuing usage of S-nail and reporting
back that the real bug was still not fixed!
(How could it ever work at all? I can tell you: because whereas
the string dope storage DOES fill chunks with random content once
they are freed, our memory pool wrapper DOES NOT! AARGH!)
So, looking solely at your debugger output, reversed:
|#7 0x00001e9eff229134 in _imap_getcred () from /usr/local/bin/s-nail
if (ok_blook(v15_compat))
rv = ccred_lookup(ccredp, urlp);
else {
[This is where we go, you don't use *v15-compat* [hint! hint! hint!]]
char *var, *old,
*xuhp = (urlp->url_had_user ? urlp->url_eu_h_p.s : urlp->url_u_h_p.s);
if ((var = mbp->mb_imap_pass) != NULL) {
var = savecat("password-", xuhp);
if ((old = vok_vlook(var)) != NULL)
old = sstrdup(old);
vok_vset(var, mbp->mb_imap_pass);
}
rv = ccred_lookup_old(ccredp, CPROTO_IMAP, xuhp);
|#6 0x00001e9eff20c806 in _var_vokset () from /usr/local/bin/s-nail
So the IMAP password cache was set, we set the non-*v15-compat*
*password-USER@HOST* to that very value. First of all however we
save away the current value of *password-USER@HOST* so that we are
later able to restore it. The bug was that "old = sstrdup(old)"
was missing, so that the memory was not available in the later
if (var != NULL) {
if (old != NULL) {
vok_vset(var, old);
[HERE ^]
Or say, it could have been available "as memory" but without the
original content, then. Anway, trying strlen() bailed.
Or do i misread the debugger output?
But note it doesn't matter when you now say WHY THE HECK DON'T YOU
USE *password-USER@HOST* WHEN IT IS SET OVER THERE? Well, it
turns out that it doesn't matter at all, because if the IMAP
password cache is set like that then you are on the same account,
says imap.c, so the password won't go over the wire anyway, it is
solely for the purpose of not asking for a password on the
terminal so that Ypnose doesn't have to store his passwords in
.netrc or encrypted via gpg(1) a.k.a. *agent-shell-lookup* on the
rare occasions where he uses S-nail to access multiple folders on
the same IMAP account.
It is a hack that made it possible to implement at least a bit of
modern code flow all through the way, via URL objects.
I.e., user credentials will be collected _before_ a socket
connection is made to the outer world now. Before you would have
been asked once they were actually needed, and if it was with an
open socket connection. I think of that as an improvement.
For example, v14.8 will bring some modest (too few! too few!)
updates to openssl.c: the changeset "[ssl1] SSL: use struct url;
use OXM: gain chains; drop *ssl-v2-allow*.." on [next] is a good
example of what i mean (shortened):
Move away from char buffers, convert anything as necessary to
be able to pass struct url* all through down the call chain.
This step allows simple usage of the xok_*look()up series instead
of unrolling specialized lookup functions, so let's say goodbye to
ssl_method_string(), imap_use_starttls(), _pop3_use_starttls(),
_pop3_no_apop() and whatever else i have forgotten.
At the same time we gain some more user flexibility: say hello to
*ssl-cert-HOST*, *ssl-key-HOST*, *ssl-method-HOST*,
*ssl-verify-HOST* and whatever else i have forgotten.
I think it is just fine not to require *v15-compat* for these.
This is just one of the steps that -- simply -- were impossible to
even dream of beforehand.
But coming back to you and the crash you see, finally.
At the moment i'm a bit out of ideas, i've just implemented
a special new *memdebug* variable ([next]) and ran all the tests
and connected to my local dovecot like grazy, but there is no
memory canary violation and the forgotten and now on [master]
existing memory trashing doesn't say a word, too. What could it
be? All i can offer would be a diff as attached, that should
apply cleanly to [master] (simply say "git apply tim.diff").
It should crash saying something.
Thankful for any further input,
Ciao,
--steffen
diff --git a/imap.c b/imap.c
index 643c71f..9e56315 100644
--- a/imap.c
+++ b/imap.c
@@ -1172,11 +1172,15 @@ _imap_getcred(struct mailbox *mbp, struct ccred *ccredp, struct url *urlp)
var = savecat("password-", xuhp);
if ((old = vok_vlook(var)) != NULL)
old = sstrdup(old);
+fprintf(stderr, "GETCRED SETS IMAP_PASS %p .. ", mbp->mb_imap_pass);
+fprintf(stderr, "%s\n", mbp->mb_imap_pass);
vok_vset(var, mbp->mb_imap_pass);
}
rv = ccred_lookup_old(ccredp, CPROTO_IMAP, xuhp);
if (var != NULL) {
if (old != NULL) {
+fprintf(stderr, "GETCRED RESTORES OLD %p .. ", old);
+fprintf(stderr, "%s\n", old);
vok_vset(var, old);
free(old);
} else
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
S-nail-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/s-nail-users