krb5-wrap: Use the principal returned by the KDC to create the ccache
authorAndreas Schneider <asn@cryptomilk.org>
Tue, 3 Feb 2015 12:00:34 +0000 (13:00 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 30 Jul 2015 08:24:26 +0000 (10:24 +0200)
We request a TGT in uppercase from the KDC. We turned on
canonicalization for that so the KDC returns the principal in lowercase
cause of this. As we use the uppercase prinicpal to create the ccache we
fail to find the tickets we need later because it is stored in the
incorrect case. You have to use the princial returned by the KDC here.

Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
lib/krb5_wrap/krb5_samba.c

index 22975c1c8a3cb05b980bba52d136ab283154ac70..490d72392233dc5168a31abe16fc3ec27d30582b 100644 (file)
@@ -1717,6 +1717,14 @@ krb5_error_code kerberos_kinit_password_cc(krb5_context ctx, krb5_ccache cc,
                return code;
        }
 
+#ifndef SAMBA4_USES_HEIMDAL /* MIT */
+       /*
+        * We need to store the principal as returned from the KDC to the
+        * credentials cache. If we don't do that the KRB5 library is not
+        * able to find the tickets it is looking for
+        */
+       principal = my_creds.client;
+#endif
        code = krb5_cc_initialize(ctx, cc, principal);
        if (code) {
                goto done;