{"thread":{"id":"3991","subject":"[PATCH]: Allow misc https cert for git-svnimport","startedAt":"2006-04-28T15:01:05Z","lastAt":"2006-05-02T21:44:55Z","messageCount":2,"participants":["P. Christeas","Eric Wong"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"19231","messageId":"200604281801.07155.p_christ@hol.gr","threadId":"3991","inReplyTo":null,"subject":"[PATCH]: Allow misc https cert for git-svnimport","fromName":"P. Christeas","fromEmail":"p_christ@hol.gr","sentAt":"2006-04-28T15:01:05Z","receivedAt":"2006-04-28T15:01:05Z","isPatch":true,"sender":{"key":"p_christ@hol.gr","avatar":null},"body":"Just had to access a server with a broken certificate (self signed), so I \nadded that patch to git-svnimport.\n\n\n\n--- /usr/bin/git-svnimport\t2006-04-13 09:39:39.000000000 +0300\n+++ /home/panos/bin/git-svnimport\t2006-04-28 17:55:45.000000000 +0300\n@@ -96,9 +96,14 @@\n sub conn {\n \tmy $self = shift;\n \tmy $repo = $self->{'fullrep'};\n-\tmy $auth = SVN::Core::auth_open ([SVN::Client::get_simple_provider,\n+# \tmy $auth = SVN::Core::auth_open ([SVN::Client::get_simple_provider,\n+# \t\t\t  SVN::Client::get_ssl_server_trust_file_provider,\n+# \t\t\t  SVN::Client::get_ssl_server_trust_prompt_provider(\\&_trust_callback),\n+# \t\t\t  SVN::Client::get_username_provider]);\n+\tmy $auth = [SVN::Client::get_simple_provider,\n \t\t\t  SVN::Client::get_ssl_server_trust_file_provider,\n-\t\t\t  SVN::Client::get_username_provider]);\n+\t\t\t  SVN::Client::get_ssl_server_trust_prompt_provider(\\&_trust_callback),\n+\t\t\t  SVN::Client::get_username_provider];\n \tmy $s = SVN::Ra->new(url => $repo, auth => $auth);\n \tdie \"SVN connection to $repo: $!\\n\" unless defined $s;\n \t$self->{'svn'} = $s;\n@@ -125,6 +130,45 @@\n \treturn $name;\n }\n \n+sub _trust_callback {\n+\tmy ($cred,$realm,$ifailed,$server_cert_info,$may_save) = @_;\n+\t#$cred->accepted_failures($SVN::Auth::SSL::UNKNOWNCA);\n+\tprint \"SSL certificate is not trusted: $ifailed \\n\";\n+\tprint \"Fingerprint: \" . $server_cert_info->fingerprint . \"\\n\";\n+\tprint \"Hostname:    \". $server_cert_info->hostname ;\n+\tprint \" (MISMATCH)\" if ( $ifailed & $SVN::Auth::SSL::CNMISMATCH);\n+\tprint \"\\n\";\n+\t\n+\tprint \"Valid from:  \". $server_cert_info->valid_from;\n+\tprint \" (NOT YET)\" if ( $ifailed & $SVN::Auth::SSL::NOTYETVALID);\n+\tprint \"\\n\";\n+\t\n+\tprint \"Valid until: \". $server_cert_info->valid_until;\n+\tprint \" (EXPIRED)\" if ( $ifailed & $SVN::Auth::SSL::EXPIRED);\n+\tprint \"\\n\";\n+\t\n+\tprint \"Issuer:      \". $server_cert_info->issuer_dname;\n+\tprint \" (UNKNOWN)\" if ( $ifailed & $SVN::Auth::SSL::UNKNOWNCA);\n+\tprint \"\\n\\n\";\n+\t\n+\tprint \"Do you still want to accept that certificate? [y/N] \";\n+\tmy $accept = <STDIN>;\n+\tchomp($accept);\n+\tprint \"\\n\";\n+\tif (($accept eq \"y\") or ($accept eq \"Y\" )) {\n+\t\t$cred->accepted_failures($ifailed);\n+\t# \tprint \"Save cert, so that it is accepted in future calls? [y/N] \";\n+\t# \tmy $mmsave = <STDIN>;\n+\t# \tchomp($mmsave);\n+\t# \tif (($mmsave eq \"y\") or ($mmsave eq \"Y\" )) {\n+\t# \t\t$may_save = 1;\n+\t# \t}\n+\t\tprint \"\\n\";\n+\t}\n+\n+}\n+\n+\n package main;\n use URI;\n \n"},{"id":"19377","messageId":"20060502214455.GA4591@hand.yhbt.net","threadId":"3991","inReplyTo":"200604281801.07155.p_christ@hol.gr","subject":"Re: [PATCH]: Allow misc https cert for git-svnimport","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2006-05-02T21:44:55Z","receivedAt":"2006-05-02T21:44:55Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"\"P. Christeas\" <p_christ@hol.gr> wrote:\n> Just had to access a server with a broken certificate (self signed), so I \n> added that patch to git-svnimport.\n\nMatthias should know more about git-svnimport than I do :)\n\nI'm not fully up-to-date on how the SVN:: modules work for this, nor do\nI know off the top of my head an ssl svn server with a self-signed cert\nto test with.  I just copied the ssl stuff off svn-mirror a while ago :)\n\n> --- /usr/bin/git-svnimport\t2006-04-13 09:39:39.000000000 +0300\n> +++ /home/panos/bin/git-svnimport\t2006-04-28 17:55:45.000000000 +0300\n> @@ -96,9 +96,14 @@\n>  sub conn {\n>  \tmy $self = shift;\n>  \tmy $repo = $self->{'fullrep'};\n> -\tmy $auth = SVN::Core::auth_open ([SVN::Client::get_simple_provider,\n> +# \tmy $auth = SVN::Core::auth_open ([SVN::Client::get_simple_provider,\n> +# \t\t\t  SVN::Client::get_ssl_server_trust_file_provider,\n> +# \t\t\t  SVN::Client::get_ssl_server_trust_prompt_provider(\\&_trust_callback),\n> +# \t\t\t  SVN::Client::get_username_provider]);\n> +\tmy $auth = [SVN::Client::get_simple_provider,\n>  \t\t\t  SVN::Client::get_ssl_server_trust_file_provider,\n> -\t\t\t  SVN::Client::get_username_provider]);\n> +\t\t\t  SVN::Client::get_ssl_server_trust_prompt_provider(\\&_trust_callback),\n> +\t\t\t  SVN::Client::get_username_provider];\n>  \tmy $s = SVN::Ra->new(url => $repo, auth => $auth);\n>  \tdie \"SVN connection to $repo: $!\\n\" unless defined $s;\n>  \t$self->{'svn'} = $s;\n> @@ -125,6 +130,45 @@\n>  \treturn $name;\n>  }\n>  \n> +sub _trust_callback {\n> +\tmy ($cred,$realm,$ifailed,$server_cert_info,$may_save) = @_;\n> +\t#$cred->accepted_failures($SVN::Auth::SSL::UNKNOWNCA);\n> +\tprint \"SSL certificate is not trusted: $ifailed \\n\";\n> +\tprint \"Fingerprint: \" . $server_cert_info->fingerprint . \"\\n\";\n> +\tprint \"Hostname:    \". $server_cert_info->hostname ;\n> +\tprint \" (MISMATCH)\" if ( $ifailed & $SVN::Auth::SSL::CNMISMATCH);\n> +\tprint \"\\n\";\n> +\t\n> +\tprint \"Valid from:  \". $server_cert_info->valid_from;\n> +\tprint \" (NOT YET)\" if ( $ifailed & $SVN::Auth::SSL::NOTYETVALID);\n> +\tprint \"\\n\";\n> +\t\n> +\tprint \"Valid until: \". $server_cert_info->valid_until;\n> +\tprint \" (EXPIRED)\" if ( $ifailed & $SVN::Auth::SSL::EXPIRED);\n> +\tprint \"\\n\";\n> +\t\n> +\tprint \"Issuer:      \". $server_cert_info->issuer_dname;\n> +\tprint \" (UNKNOWN)\" if ( $ifailed & $SVN::Auth::SSL::UNKNOWNCA);\n> +\tprint \"\\n\\n\";\n> +\t\n> +\tprint \"Do you still want to accept that certificate? [y/N] \";\n> +\tmy $accept = <STDIN>;\n> +\tchomp($accept);\n> +\tprint \"\\n\";\n> +\tif (($accept eq \"y\") or ($accept eq \"Y\" )) {\n> +\t\t$cred->accepted_failures($ifailed);\n> +\t# \tprint \"Save cert, so that it is accepted in future calls? [y/N] \";\n> +\t# \tmy $mmsave = <STDIN>;\n> +\t# \tchomp($mmsave);\n> +\t# \tif (($mmsave eq \"y\") or ($mmsave eq \"Y\" )) {\n> +\t# \t\t$may_save = 1;\n> +\t# \t}\n> +\t\tprint \"\\n\";\n> +\t}\n> +\n> +}\n> +\n> +\n>  package main;\n>  use URI;\n>  \n\n\n-- \nEric Wong\n"}]}