Commits

Luke Cyca committed 177b145

Bail out if server doesn't advertise Negotiate support

  • Participants
  • Parent commits 2cd5993

Comments (0)

Files changed (1)

File hgssoauthentication/__init__.py

         pass
 
     def http_error_401(self, req, fp, code, msg, headers):
+        if "Negotiate" not in headers.get("WWW-Authenticate", ""):
+            print "Kerberos not supported"
+            return
 
         # Count the number of failures on this request
         if hasattr(req, 'failure_count'):
             mercurial.url.handlerfuncs.remove(self.__class__)
             return
 
-        supported_schemes = [s.strip() for s in headers.get("WWW-Authenticate", "").split(",")]
-
         context = kerberos.authGSSClientInit("HTTP@%s" % req.get_host())[1]
-        kerberos.authGSSClientStep(context, supported_schemes[0])
+        kerberos.authGSSClientStep(context, "")
         response = kerberos.authGSSClientResponse(context)
         req.add_unredirected_header('Authorization', "Negotiate %s" % response)
         resp = self.parent.open(req)