Beispiel #1
0
 def load(self):
     """Load credentials from the OS."""
     ccache = krb5.cc_default()
     if not os.access(ccache, os.R_OK):
         raise Error, 'No ccache found'
     self.m_principal = krb5.cc_get_principal(ccache)
     self._init_ccache()
     krb5.cc_copy_creds(ccache, self.m_ccache)
     self._activate_ccache()
     self._resolve_servers_for_domain(self.m_domain)
Beispiel #2
0
 def test_cc_copy_creds(self):
     self.require(ad_user=True)
     domain = self.domain().upper()
     principal = '%[email protected]%s' % (self.ad_user_account(), domain)
     password = self.ad_user_password()
     self.acquire_credentials(principal, password)
     ccache = krb5.cc_default()
     cctmp = self.tempfile()
     assert_raises(Error, self.list_credentials, cctmp)
     krb5.cc_copy_creds(ccache, cctmp)
     ccname, princ, creds = self.list_credentials(cctmp)
     assert princ.lower() == principal.lower()
     assert len(creds) > 0
     assert creds[0] == 'krbtgt/%[email protected]%s' % (domain, domain)