[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-28 13:23:01 CET

Deal all,

I'm trying to write application which works with svn repository via https.
But I have trouble... But application can access repository only using svn

For https it writes:
PROPFIND request failed on '/svn/KG810'

I can't understand why function
svn_test1_auth_ssl_client_server_trust_prompt was not called.

Please help me to solve this problem and understand what is my mistake.

Many thanks is advance


// 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"

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

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,
    (*cred)->may_save = 0;
    (*cred)->accepted_failures = failures;

    return SVN_NO_ERROR;

int _tmain(int argc, _TCHAR* argv[])
    const char *repos_url="";
// 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;


    if (apr_allocator_create(&allocator))
        return EXIT_FAILURE;


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

    err = svn_client_create_context(&ctx, pool);
    if (err) {printf("%s", err->message);}

    err = svn_config_ensure(config_dir, pool);
    if (err) {printf("%s", err->message);}

    err = svn_config_get_config(&(ctx->config), config_dir, pool);
    if (err) {printf("%s", err->message);}

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

    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,
    if (auth_password)
        svn_auth_set_parameter(ab, SVN_AUTH_PARAM_DEFAULT_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) {printf("%s\n", err->message);}

    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;
            revision.kind = svn_opt_revision_head;

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

    err = svn_client_checkout2(NULL, true_url, target_dir,
                                   ctx, pool);
    if (err) {printf("%s\n", err->message);}

    return 0;

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 Tue Nov 28 13:23:51 2006

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