[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Linking problem with svnclient lib

From: Fedor Tyurin <fedor.tyurin_at_gmail.com>
Date: 2006-11-29 16:30:26 CET

I tryed to use libneon.lib from svn-1.3.2, because on my server svn-1.3.2 is
installed, and I got error "Malformed URL for repository". Then I replace
all svn libraries and header files on my project (initially I used 1.4.2)
and I got the same error as before:
test1: PROPFIND request failed on '/svn/KG810'
test1: PROPFIND of '/svn/KG810': SSL negotiation failed: SSL disabled due to
library version mismatch (https://172.26.40.85)

So as I understand problem is not related to version of libneon...

Does anybody have ideas?

Code of my application you'll find below:

// test1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#include "svn_pools.h"
#include "svn_client.h"
#include "svn_config.h"
#include "svn_path.h"
#include "svn_cmdline.h"
#include "svn_auth.h"
#include "svn_diff.h"

static apr_pool_t *pool = 0;
static svn_client_ctx_t* ctx = 0;

/* Version compatibility check */
static svn_error_t *
check_lib_versions(void)
{
  static const svn_version_checklist_t checklist[] =
    {
      { "svn_subr", svn_subr_version },
      { "svn_client", svn_client_version },
      { "svn_wc", svn_wc_version },
      { "svn_ra", svn_ra_version },
      { "svn_delta", svn_delta_version },
      { "svn_diff", svn_diff_version },
      { NULL, NULL }
    };

  SVN_VERSION_DEFINE(my_version);
  return svn_ver_check_list(&my_version, checklist);
}

static svn_error_t *svn_test1_auth_ssl_client_server_trust_prompt (
    svn_auth_cred_ssl_server_trust_t **cred,
    void *baton,
    const char *realm,
    apr_uint32_t failures,
    const svn_auth_ssl_server_cert_info_t *cert_info,
    svn_boolean_t may_save,
    apr_pool_t *pool)
{
    printf("hostname=%s\n", cert_info->hostname);
    printf("fingerprint=%s\n", cert_info->fingerprint);
    printf("valid_from=%s\n", cert_info->valid_from);
    printf("valid_until=%s\n", cert_info->valid_until);
    printf("issuer_dname=%s\n", cert_info->issuer_dname);
    printf("ascii_cert=%s\n", cert_info->ascii_cert);

    *cred = (svn_auth_cred_ssl_server_trust_t*) apr_palloc(pool,
sizeof(svn_auth_cred_ssl_server_trust_t));
    (*cred)->may_save = 0;
    (*cred)->accepted_failures = failures;

    return SVN_NO_ERROR;
}

int _tmain(int argc, _TCHAR* argv[])
{
    const char *repos_url="https://172.26.40.85/svn/KG810";
// const char *repos_url="svn://localhost/Test1";
    const char *target_dir="C:\\KG810wc";
    const char *config_dir="C:\\KG810cnf";
    const char *auth_username="turin";
    const char *auth_password="turinturin";

    apr_allocator_t *allocator;
    svn_error_t *err;

    svn_opt_revision_t revision;
    svn_opt_revision_t peg_revision;

    svn_auth_baton_t *ab;
    svn_config_t *cfg = 0;

    const char *true_url;

    svn_boolean_t store_password_val = TRUE;
    svn_auth_provider_object_t *provider = NULL;
    apr_array_header_t *providers = NULL;

    apr_initialize();

    if (apr_allocator_create(&allocator))
        return EXIT_FAILURE;

    apr_allocator_max_free_set(allocator,
SVN_ALLOCATOR_RECOMMENDED_MAX_FREE);

    pool = svn_pool_create_ex(NULL, allocator);
    apr_allocator_owner_set(allocator, pool);

  /* Check library versions */
  err = check_lib_versions();
  if (err)
    return svn_cmdline_handle_exit_error(err, pool, "test1: ");

  /* Initialize the RA library. */
  err = svn_ra_initialize(pool);
  if (err)
    return svn_cmdline_handle_exit_error(err, pool, "test1: ");

    err = svn_client_create_context(&ctx, pool);
    if (err) {return svn_cmdline_handle_exit_error(err, pool, "test1: ");}

    err = svn_config_ensure(config_dir, pool);
    if (err) {return svn_cmdline_handle_exit_error(err, pool, "test1: ");}

    err = svn_config_get_config(&(ctx->config), config_dir, pool);
    if (err) {return svn_cmdline_handle_exit_error(err, pool, "test1: ");}

    cfg = (svn_config_t*) apr_hash_get(ctx->config,
SVN_CONFIG_CATEGORY_CONFIG, APR_HASH_KEY_STRING);

////////////////////////////////
    providers = apr_array_make(pool, 12, sizeof(svn_auth_provider_object_t
*));

// svn_auth_get_windows_simple_provider(&provider, pool);
// APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;

    svn_auth_get_simple_provider(&provider, pool);
    APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;

    svn_auth_get_username_provider(&provider, pool);
    APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;

    svn_auth_get_ssl_server_trust_prompt_provider (&provider,
svn_test1_auth_ssl_client_server_trust_prompt, NULL, pool);
    APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;

    svn_auth_get_ssl_server_trust_file_provider(&provider, pool);
    APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;

    svn_auth_get_ssl_client_cert_file_provider(&provider, pool);
    APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;

    svn_auth_get_ssl_client_cert_pw_file_provider(&provider, pool);
    APR_ARRAY_PUSH(providers, svn_auth_provider_object_t *) = provider;

    svn_auth_open(&ab, providers, pool);

    if (auth_username)
        svn_auth_set_parameter(ab, SVN_AUTH_PARAM_DEFAULT_USERNAME,
auth_username);
    if (auth_password)
        svn_auth_set_parameter(ab, SVN_AUTH_PARAM_DEFAULT_PASSWORD,
auth_password);

    if (config_dir)
        svn_auth_set_parameter(ab, SVN_AUTH_PARAM_CONFIG_DIR, config_dir);

/////////////////////////////////

    ctx->auth_baton = ab;

    revision.kind = svn_opt_revision_head;

    if (!svn_path_is_url(repos_url)) {
        printf("Wrong url\n");
        return -1;
    }

    err = svn_opt_parse_path(&peg_revision, &true_url, repos_url, pool);
    if (err) {return svn_cmdline_handle_exit_error(err, pool, "test1: ");}

    true_url = svn_path_canonicalize(true_url, pool);

    if (revision.kind == svn_opt_revision_unspecified) {
        if (peg_revision.kind != svn_opt_revision_unspecified)
            revision = peg_revision;
        else
            revision.kind = svn_opt_revision_head;
    }

    printf("true_url=%s\n", true_url);

    err = svn_client_checkout2(NULL, true_url, target_dir,
                                   &peg_revision,
                                   &revision,
                                   TRUE,
                                   FALSE,
                                   ctx, pool);
    if (err) {
        return svn_cmdline_handle_exit_error(err, pool, "test1: ");
// svn_handle_error2(err, stderr, 0, "test1: ");
// svn_error_clear(err);
    }

    svn_pool_destroy(pool);
    return 0;
}

On 11/28/06, Fedor Tyurin <fedor.tyurin@gmail.com> wrote:
>
> Thanks a lot
>
> My application returns:
> test1: PROPFIND request failed on '/svn/KG810'
> test1: PROPFIND of '/svn/KG810': SSL negotiation failed: SSL disabled due
> to library version mismatch (https://172.26.40.85)
>
> I'm trying to understand what does it mean...
>
> By the way, when I tried to use
> svn_handle_error2(err, stderr, FALSE, "test1: ");
> svn_error_clear(err);
> instead of
> return svn_cmdline_handle_exit_error(err, pool, "test1: ");
>
> Windows exception happens and my appliation dies. Does anybody know why
> this thing appears?
>
> On 11/28/06, Erik Huelsmann <ehuels@gmail.com> wrote:
> >
> > > err = svn_client_checkout2(NULL, true_url, target_dir,
> > > &peg_revision,
> > > &revision,
> > > TRUE,
> > > FALSE,
> > > ctx, pool);
> > > if (err) {printf("%s\n", err->message);}
> >
> > If you want more information from the error, you should use something
> > like this:
> >
> > rv = svn_cmdline_handle_exit_error(err, pool, "my-util");
> >
> > > svn_pool_destroy(pool);
> > return rv;
> > > }
> >
> > It will print out all error information in the error chain. It might
> > also contain information on why the PROPFIND failed.
> >
> > HTH,
> >
> > Erik.
> >
> >
> > > On 11/22/06, Ulrich Eckhardt <eckhardt@satorlaser.com> wrote:
> > > > On Wednesday 22 November 2006 16:50, Fedor Tyurin wrote:
> > > > > I am trying to write an application that will used as a tool for
> > > > > Subversion. I am using C++ with VS .NET 2003 on WinXP SP2. In the
> > > > > properties page for the Solution I have pointed the links to the
> > library
> > > > > and include files. But when building the solution I get the
> > following
> > > > > linker errors:
> > > > >
> > > > > Linking...
> > > > > RepositoryView.obj : error LNK2019: unresolved external symbol
> > > > > _svn_repos_open referenced in function "private: void __thiscall
> > > > > CRepositoryView::FillRepositoryTree(void)"
> > > > > (?FillRepositoryTree@CRepositoryView@@AAEXXZ)
> > > >
> > > > You need to setup three things typically:
> > > > 1. The path to the headers. Otherwise the compiler will complain
> > when you
> > > try
> > > > to #include them.
> > > > 2. You need to tell the linker that it should link with the .lib
> > files.
> > > Either
> > > > you do that manually in the project setup or [this part is MS
> > specific]
> > > you
> > > > add a line in one of your sourcefiles containing
> > > > #pragma comment( lib, "foobar.lib")
> > > > 3. You need to tell the linker where to find the libraries. Either
> > you
> > > move
> > > > them or you add their location to you project/workspace/system
> > setup.
> > > >
> > > > I'd say you forgot step #2.
> > > >
> > > > Uli
> > > >
> > > >
> > >
> > **************************************************************************************
> >
> > > > Visit our website at <http://www.satorlaser.de/>
> > > >
> > >
> > **************************************************************************************
> > > > Diese E-Mail einschließlich sämtlicher Anhänge ist nur für den
> > Adressaten
> > > bestimmt und kann vertrauliche Informationen enthalten. Bitte
> > > benachrichtigen Sie den Absender umgehend, falls Sie nicht der
> > beabsichtigte
> > > Empfänger sein sollten. Die E-Mail ist in diesem Fall zu löschen und
> > darf
> > > weder gelesen, weitergeleitet, veröffentlicht oder anderweitig benutzt
> > > werden.
> > > > E-Mails können durch Dritte gelesen werden und Viren sowie
> > > nichtautorisierte Änderungen enthalten. Sator Laser GmbH ist für diese
> >
> > > Folgen nicht verantwortlich.
> > > >
> > > >
> > >
> > **************************************************************************************
> > > >
> > > >
> > >
> > >
> >
>
>
Received on Wed Nov 29 16:31:28 2006

This is an archived mail posted to the Subversion Users mailing list.