Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pysvn.Client.callback_ssl_server_trust_prompt error

Tags:

python

pysvn

I am getting the pysvn.Client.callback_ssl_server_trust_prompt required error when trying to commit. I understand it has to do with trust with the internet validation.

Here is the documentation, I just don't understand it.

pysvn.Client.callback_ssl_server_trust_prompt

import pysvn

def ssl_server_trust_prompt( trust_dict ):
    return retcode, accepted_failures, save

client = pysvn.Client()
client.callback_ssl_server_trust_prompt = ssl_server_trust_prompt

The callback_ssl_server_trust_prompt is called each time an HTTPS server presents a certificate and subversion is not sure if it should be trusted. callback_ssl_server_trust_prompt is called with information about the certificate in trust dict.

failures - int - a bitmask of failures

  • [What do these bits mean?] hostname - string - the hostname the certificate was presented from finger_print - string - certificate finger print valid_from - string - valid from this ISO8601 date valid_until - string - valid util this ISO8601 date issuer_dname - stirng - the issued dname realm - string - the realm pysvn expect the callback_ssl_server_trust_prompt to return a tuple of three values (retcode, accepted_failures, save).

retcode - boolean, False if no username and password are available. True if subversion is to use the username and password. accepted_failures - int, the accepted failures allowed save - boolean, return True if you want subversion to remember the certificate in the configuration directory. return False to prevent saving the certificate.

like image 298
shawn Avatar asked Mar 06 '26 16:03

shawn


1 Answers

When pysvn attempts to perform operations on a repository that you access using https, it needs to validate the servers identity. This is done by calling a function called callback_ssl_server_trust_prompt. By default this function is not defined. You, as the programmer, must supply the trust information, which you do by writing a function that looks at the information in the trust dictionary, and returns a tuple of 3 values (described in the third paragraph of the documentation).

Once you have written the function, you make it the callback_ssl_server_trust_prompt by assigning your function name to client.callback_ssl_server_trust_prompt

like image 77
natet Avatar answered Mar 08 '26 05:03

natet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!