Commits

Mitsuhiro Koga  committed 1456113

svnwrap: Implement handling of ssl_client_cert_pw_prompt_provider

  • Participants
  • Parent commits c500bc8

Comments (0)

Files changed (3)

File hgsubversion/svnrepo.py

         cert_file = self.ui.prompt('Client certificate filename: ', default='')
         return (cert_file, bool(may_save))
 
+    def ssl_client_cert_pw(self, realm, may_save, pool=None):
+        password = self.ui.getpass('Passphrase for \'%s\': ' % (realm,), default='')
+        return (password, bool(may_save))
+
     def ssl_server_trust(self, realm, failures, cert_info, may_save, pool=None):
         msg = 'Error validating server certificate for \'%s\':\n' % (realm,)
         if failures & svnwrap.SSL_UNKNOWNCA:

File hgsubversion/svnwrap/subvertpy_wrapper.py

         def ssl_client_cert(realm, may_save):
             return _prompt.ssl_client_cert(realm, may_save)
 
+        def ssl_client_cert_pw(realm, may_save):
+            return _prompt.ssl_client_cert_pw(realm, may_save)
+
         def ssl_server_trust(realm, failures, cert_info, may_save):
             creds = _prompt.ssl_server_trust(realm, failures, cert_info, may_save)
             if creds is None:
                 ra.get_simple_prompt_provider(simple, 2),
                 ra.get_username_prompt_provider(username, 2),
                 ra.get_ssl_client_cert_prompt_provider(ssl_client_cert, 2),
+                ra.get_ssl_client_cert_pw_prompt_provider(ssl_client_cert_pw, 2),
                 ra.get_ssl_server_trust_prompt_provider(ssl_server_trust),
             ]
 

File hgsubversion/svnwrap/svn_swig_wrapper.py

     (creds.cert_file, creds.may_save) = ret
     return creds
 
+def _ssl_client_cert_pw(realm, may_save, pool):
+    ret = _prompt.ssl_client_cert_pw(realm, may_save, pool)
+    creds = core.svn_auth_cred_ssl_client_cert_pw_t()
+    (creds.password, creds.may_save) = ret
+    return creds
+
 def _ssl_server_trust(realm, failures, cert_info, may_save, pool):
     cert = [
             cert_info.hostname,
             client.get_simple_prompt_provider(_simple, 2),
             client.get_username_prompt_provider(_username, 2),
             client.get_ssl_client_cert_prompt_provider(_ssl_client_cert, 2),
+            client.get_ssl_client_cert_pw_prompt_provider(_ssl_client_cert_pw, 2),
             client.get_ssl_server_trust_prompt_provider(_ssl_server_trust),
             ]