$OpenBSD: patch-impacket_krb5_kerberosv5_py,v 1.1 2016/05/26 09:29:23 dcoppa Exp $

commit 49a07a5fa7372abd7a6b5eeec8d039b1add4e86d
Author: asolino <bethus@gmail.com>
Date:   Mon Apr 11 10:58:16 2016 -0300

Retrieve user principal name from CCache file.
Fixes Kerberos authentication for wmiexec.py

--- impacket/krb5/kerberosv5.py.orig	Wed Jan  6 10:01:32 2016
+++ impacket/krb5/kerberosv5.py	Wed May 25 08:53:11 2016
@@ -440,6 +440,11 @@ def getKerberosType1(username, password, domain, lmhas
                 # No cache present
                 pass
             else:
+                # retrieve user and domain information from CCache file if needed
+                if username == '' and len(ccache.principal.components) > 0:
+                    username = ccache.principal.components[0]['data']
+                if domain == '':
+                    domain = ccache.principal.realm['data']
                 LOG.debug("Using Kerberos Cache: %s" % os.getenv('KRB5CCNAME'))
                 principal = 'host/%s@%s' % (targetName.upper(), domain.upper())
                 creds = ccache.getCredential(principal)
