Example #1
0
static svn_error_t *
create_ra_callbacks(svn_ra_callbacks2_t **callbacks,
                    const char *username,
                    const char *password,
                    svn_boolean_t non_interactive,
                    apr_pool_t *pool)
{
  SVN_ERR(svn_ra_create_callbacks(callbacks, pool));

  SVN_ERR(svn_cmdline_create_auth_baton(&(*callbacks)->auth_baton,
                                        non_interactive,
                                        username, password, NULL, FALSE,
                                        FALSE, NULL, NULL, NULL, pool));

  (*callbacks)->open_tmp_file = open_tmp_file;

  return SVN_NO_ERROR;
}
Example #2
0
/* Initialize the RA layer, and set *CTX to a new client context baton
 * allocated from POOL.  Use CONFIG_DIR and pass USERNAME, PASSWORD,
 * CONFIG_DIR and NO_AUTH_CACHE to initialize the authorization baton.
 * CONFIG_OPTIONS (if not NULL) is a list of configuration overrides.
 */
static svn_error_t *
init_client_context(svn_client_ctx_t **ctx_p,
                    svn_boolean_t non_interactive,
                    const char *username,
                    const char *password,
                    const char *config_dir,
                    svn_boolean_t no_auth_cache,
                    svn_boolean_t trust_server_cert,
                    apr_array_header_t *config_options,
                    apr_pool_t *pool)
{
    svn_client_ctx_t *ctx = NULL;
    svn_config_t *cfg_config;

    SVN_ERR(svn_ra_initialize(pool));

    SVN_ERR(svn_config_ensure(config_dir, pool));
    SVN_ERR(svn_client_create_context(&ctx, pool));

    SVN_ERR(svn_config_get_config(&(ctx->config), config_dir, pool));

    if (config_options)
        SVN_ERR(svn_cmdline__apply_config_options(ctx->config, config_options,
                "svnrdump: ", "--config-option"));

    cfg_config = apr_hash_get(ctx->config, SVN_CONFIG_CATEGORY_CONFIG,
                              APR_HASH_KEY_STRING);

    /* Set up our cancellation support. */
    ctx->cancel_func = check_cancel;

    /* Default authentication providers for non-interactive use */
    SVN_ERR(svn_cmdline_create_auth_baton(&(ctx->auth_baton), non_interactive,
                                          username, password, config_dir,
                                          no_auth_cache, trust_server_cert,
                                          cfg_config, ctx->cancel_func,
                                          ctx->cancel_baton, pool));
    *ctx_p = ctx;
    return SVN_NO_ERROR;
}
Example #3
0
/* fonction permettant d'initialiser le contexte avant toute opération svn */
svn_client_ctx_t *initialize_context(){  
  svn_error_t *err;
  svn_config_t *cfg;
  
  err = svn_config_ensure (NULL, pool);
  
  if (err) {
    svn_handle_error2 (err, stderr, FALSE, "svn_support: ");
    return NULL;
  }
  
  // -- Creation du contexte --
  svn_client_create_context(&ctx,pool);
  svn_config_get_config (&(ctx->config), NULL, pool);
 
  // -- Récupération du fichier de config dans ~/.subversion --
  const char *config_path;
  svn_config_get_user_config_path(&config_path,
                                  NULL,
                                  SVN_CONFIG_CATEGORY_CONFIG,
                                  pool);
  svn_config_read(&cfg,
		  config_path,
		  TRUE,
		  pool);
  
  // -- Initialisation des parametres d'authentification --
  svn_cmdline_create_auth_baton(&ctx->auth_baton,
                                TRUE,
                                NULL,
                                NULL,
                                config_path,
                                FALSE,
                                FALSE,
                                cfg,
                                cancel,
                                ctx->cancel_baton,
                                pool);
  return ctx;
}