Re: Race condition on change of expired password?

Nico Williams <[email protected]>
Newsgroups gmane.comp.encryption.kerberos.heimdal.general
Message-ID <CAK3OfOiUAQ7qB9LA0gZXWo4c_MraC2H5OxgsqeAR9KoKQAr-7A@mail.gmail.com>
LGTM.  Building, will push.

I think the bug was introduced in this commit:


commit 69ea9b38e9487b38ac6a7101dd32811c74fb7fcd
Author: Matthias Dieter Wallnöfer <[email protected]>
Date:   Tue Mar 16 15:53:39 2010 +0100

    heimdal - fix overlapped identifiers in the "krb5" library

which did this:


--- a/lib/krb5/init_creds_pw.c
+++ b/lib/krb5/init_creds_pw.c
@@ -2002,7 +2002,7 @@ krb5_get_init_creds_password(krb5_context context,


     if (ret == KRB5KDC_ERR_KEY_EXPIRED && chpw == 0) {
-       char buf[1024];
+       char buf2[1024];

        /* try to avoid recursion */
        if (in_tkt_service != NULL && strcmp(in_tkt_service,
"kadmin/changepw") == 0)
@@ -2015,7 +2015,7 @@ krb5_get_init_creds_password(krb5_context context,
        ret = change_password (context,
                               client,
                               ctx->password,
-                              buf,
+                              buf2,
                               sizeof(buf),
                               prompter,
                               data,

which causes the new password to no longer be in buf.  What was
missing was the password = buf2, although I don't really understand
the point of buf2 given that there's no dangling reference to buf
where we re-used it.

Nico
--
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.