71
72
return url, peg_revision, start_revision, end_revision
75
def prompt_func_ssl_unknown_cert(realm, failures, cert_info, may_save, pool):
76
print "The certficate details are as follows:"
77
print "--------------------------------------"
78
print "Issuer : " + str(cert_info.issuer_dname)
79
print "Hostname : " + str(cert_info.hostname)
80
print "ValidFrom : " + str(cert_info.valid_from)
81
print "ValidUpto : " + str(cert_info.valid_until)
82
print "Fingerprint: " + str(cert_info.fingerprint)
84
ssl_trust = core.svn_auth_cred_ssl_server_trust_t()
86
choice = raw_input( "accept (t)temporarily (p)permanently: ")
88
choice = raw_input( "(r)Reject or accept (t)temporarily: ")
89
if choice[0] == "t" or choice[0] == "T":
90
ssl_trust.may_save = False
91
ssl_trust.accepted_failures = failures
92
elif choice[0] == "p" or choice[0] == "P":
93
ssl_trust.may_save = True
94
ssl_trust.accepted_failures = failures
99
def prompt_func_simple_prompt(realm, username, may_save, pool):
100
username = raw_input("username: ")
101
password = getpass.getpass(prompt="password: ")
102
simple_cred = core.svn_auth_cred_simple_t()
103
simple_cred.username = username
104
simple_cred.password = password
105
simple_cred.may_save = False
108
def prompt_func_gnome_keyring_prompt(keyring, pool):
109
return getpass.getpass(prompt="Password for '%s' GNOME keyring: " % keyring)
76
113
url, peg_revision, start_revision, end_revision = parse_args(sys.argv[1:])
92
129
core.svn_config_ensure(None)
130
ctx = client.svn_client_create_context()
131
ctx.config = core.svn_config_get_config(None)
95
133
# Make sure that these are at the start of the list, so passwords from
96
134
# gnome-keyring / kwallet are checked before asking for new passwords.
97
# Note that we don't pass our config here, since we can't seem to access
98
# ctx.config.config (ctx.config is opaque).
99
providers = core.svn_auth_get_platform_specific_client_providers(None, None)
135
providers = core.svn_auth_get_platform_specific_client_providers(ctx.config['config'], None)
100
136
providers.extend([
101
137
client.get_simple_provider(),
138
core.svn_auth_get_ssl_server_trust_file_provider(),
139
core.svn_auth_get_simple_prompt_provider(prompt_func_simple_prompt, 2),
140
core.svn_auth_get_ssl_server_trust_prompt_provider(prompt_func_ssl_unknown_cert),
102
141
client.get_username_provider(),
103
142
client.get_ssl_server_trust_file_provider(),
104
143
client.get_ssl_client_cert_file_provider(),
108
147
ctx.auth_baton = core.svn_auth_open(providers)
109
ctx.config = core.svn_config_get_config(None)
149
if hasattr(core, 'svn_auth_set_gnome_keyring_unlock_prompt_func'):
150
core.svn_auth_set_gnome_keyring_unlock_prompt_func(ctx.auth_baton, prompt_func_gnome_keyring_prompt)
111
152
ra_callbacks = ra.callbacks_t()
112
153
ra_callbacks.auth_baton = ctx.auth_baton