Esempio n. 1
0
        static unsafe /*svn_error_t*/ IntPtr _svn_auth_ssl_client_cert_prompt_func(
            /*out svn_auth_cred_ssl_client_cert_t*/ void **credPtr, IntPtr baton, sbyte *realm, int maySave, /*apr_pool_t*/ IntPtr pool)
        {
            var wrapper = AprBaton <SvnAuthWrapper <SvnSslClientCertificateEventArgs> > .Get(baton);

            var args = new SvnSslClientCertificateEventArgs(SvnBase.Utf8_PtrToString(realm), maySave != 0);

            var cred = (svn_auth_cred_ssl_client_cert_t.__Internal * *)credPtr;

            using (var tmpPool = new AprPool(pool, false))
            {
                *cred = null;
                try
                {
                    wrapper.Raise(args);
                }
                catch (Exception e)
                {
                    return(SvnException.CreateExceptionSvnError("Authorization handler", e).__Instance);
                }

                if (args.Cancel)
                {
                    return(svn_error.svn_error_create((int)SvnErrorCode.SVN_ERR_CANCELLED, null, "Authorization canceled operation").__Instance);
                }
                if (args.Break)
                {
                    return(IntPtr.Zero);
                }

                *cred = (svn_auth_cred_ssl_client_cert_t.__Internal *)tmpPool.AllocCleared(
                    sizeof(svn_auth_cred_ssl_client_cert_t.__Internal));

                (*cred)->cert_file = new IntPtr(tmpPool.AllocString(args.CertificateFile));
                (*cred)->may_save  = args.Save ? 1 : 0;
            }

            return(IntPtr.Zero);
        }
Esempio n. 2
0
 static void ImpSubversionFileSslClientCertificateHandler(object sender, SvnSslClientCertificateEventArgs e) => e.Break = true;