コード例 #1
0
static svn_error_t *
ssl_server_trust_file_save_credentials(svn_boolean_t *saved,
                                       void *credentials,
                                       void *provider_baton,
                                       apr_hash_t *parameters,
                                       const char *realmstring,
                                       apr_pool_t *pool)
{
  svn_auth_cred_ssl_server_trust_t *creds = credentials;
  const svn_auth_ssl_server_cert_info_t *cert_info;
  apr_hash_t *creds_hash = NULL;
  const char *config_dir;

  if (! creds->may_save)
    return SVN_NO_ERROR;

  config_dir = svn_hash_gets(parameters, SVN_AUTH_PARAM_CONFIG_DIR);

  cert_info = svn_hash_gets(parameters, SVN_AUTH_PARAM_SSL_SERVER_CERT_INFO);

  creds_hash = apr_hash_make(pool);
  svn_hash_sets(creds_hash, SVN_CONFIG_AUTHN_ASCII_CERT_KEY,
                svn_string_create(cert_info->ascii_cert, pool));
  svn_hash_sets(creds_hash, SVN_CONFIG_AUTHN_FAILURES_KEY,
                svn_string_createf(pool, "%lu",
                                   (unsigned long)creds->accepted_failures));

  SVN_ERR(svn_config_write_auth_data(creds_hash,
                                     SVN_AUTH_CRED_SSL_SERVER_TRUST,
                                     realmstring,
                                     config_dir,
                                     pool));
  *saved = TRUE;
  return SVN_NO_ERROR;
}
コード例 #2
0
ファイル: id.c プロジェクト: Ranga123/test1
svn_string_t *
svn_fs_base__id_unparse(const svn_fs_id_t *id,
                        apr_pool_t *pool)
{
    id_private_t *pvt = id->fsap_data;

    return svn_string_createf(pool, "%s.%s.%s",
                              pvt->node_id, pvt->copy_id, pvt->txn_id);
}
コード例 #3
0
svn_string_t *
svn_fs_fs__id_unparse(const svn_fs_id_t *id,
                      apr_pool_t *pool)
{
  const char *txn_rev_id;
  id_private_t *pvt = id->fsap_data;

  if ((! pvt->txn_id))
    {
      txn_rev_id = apr_psprintf(pool, "%ld/%"
                                APR_OFF_T_FMT, pvt->rev, pvt->offset);
    }
  else
    {
      txn_rev_id = pvt->txn_id;
    }
  return svn_string_createf(pool, "%s.%s.%c%s",
                            pvt->node_id, pvt->copy_id,
                            (pvt->txn_id ? 't' : 'r'),
                            txn_rev_id);
}
コード例 #4
0
ファイル: ra_plugin.c プロジェクト: aosm/subversion
static svn_error_t *
get_node_props(apr_hash_t **props,
               svn_ra_local__session_baton_t *sess,
               svn_fs_root_t *root,
               const char *path,
               apr_pool_t *pool)
{
  svn_revnum_t cmt_rev;
  const char *cmt_date, *cmt_author;

  /* Create a hash with props attached to the fs node. */
  SVN_ERR(svn_fs_node_proplist(props, root, path, pool));

  /* Now add some non-tweakable metadata to the hash as well... */

  /* The so-called 'entryprops' with info about CR & friends. */
  SVN_ERR(svn_repos_get_committed_info(&cmt_rev, &cmt_date,
                                       &cmt_author, root, path, pool));

  apr_hash_set(*props,
               SVN_PROP_ENTRY_COMMITTED_REV,
               APR_HASH_KEY_STRING,
               svn_string_createf(pool, "%ld", cmt_rev));
  apr_hash_set(*props,
               SVN_PROP_ENTRY_COMMITTED_DATE,
               APR_HASH_KEY_STRING,
               cmt_date ? svn_string_create(cmt_date, pool) : NULL);
  apr_hash_set(*props,
               SVN_PROP_ENTRY_LAST_AUTHOR,
               APR_HASH_KEY_STRING,
               cmt_author ? svn_string_create(cmt_author, pool) : NULL);
  apr_hash_set(*props,
               SVN_PROP_ENTRY_UUID,
               APR_HASH_KEY_STRING,
               svn_string_create(sess->uuid, pool));

  /* We have no 'wcprops' in ra_local, but might someday. */

  return SVN_NO_ERROR;
}
コード例 #5
0
static svn_error_t *
test_one_long_keyword(const char *keyword,
                      const char *expected,
                      apr_pool_t *pool)
{
  svn_string_t *src_string;
  svn_stream_t *src_stream, *dst_stream;
  svn_stringbuf_t *dst_stringbuf, *src_stringbuf;
  apr_hash_t *keywords = apr_hash_make(pool);
  svn_string_t *expanded = svn_string_create("abcdefg", pool);

  svn_hash_sets(keywords, keyword, expanded);

  /* Expand */
  src_string = svn_string_createf(pool, "$%s$", keyword);
  src_stream = svn_stream_from_string(src_string, pool);
  dst_stringbuf = svn_stringbuf_create_empty(pool);
  dst_stream = svn_stream_from_stringbuf(dst_stringbuf, pool);
  dst_stream = svn_subst_stream_translated(dst_stream, NULL, FALSE, keywords,
                                           TRUE, pool);
  SVN_ERR(svn_stream_copy3(src_stream, dst_stream, NULL, NULL, pool));

  SVN_TEST_STRING_ASSERT(dst_stringbuf->data, expected);

  /* Unexpand */
  src_stringbuf = dst_stringbuf;
  src_stream = svn_stream_from_stringbuf(src_stringbuf, pool);
  dst_stringbuf = svn_stringbuf_create_empty(pool);
  dst_stream = svn_stream_from_stringbuf(dst_stringbuf, pool);
  dst_stream = svn_subst_stream_translated(dst_stream, NULL, FALSE, keywords,
                                           FALSE, pool);
  SVN_ERR(svn_stream_copy3(src_stream, dst_stream, NULL, NULL, pool));

  SVN_TEST_STRING_ASSERT(dst_stringbuf->data, src_string->data);

  return SVN_NO_ERROR;
}
コード例 #6
0
ファイル: cache.c プロジェクト: 2asoft/freebsd
svn_string_t *
svn_cache__format_info(const svn_cache__info_t *info,
                       svn_boolean_t access_only,
                       apr_pool_t *result_pool)
{
  enum { _1MB = 1024 * 1024 };

  apr_uint64_t misses = info->gets - info->hits;
  double hit_rate = (100.0 * (double)info->hits)
                  / (double)(info->gets ? info->gets : 1);
  double write_rate = (100.0 * (double)info->sets)
                    / (double)(misses ? misses : 1);
  double data_usage_rate = (100.0 * (double)info->used_size)
                         / (double)(info->data_size ? info->data_size : 1);
  double data_entry_rate = (100.0 * (double)info->used_entries)
                 / (double)(info->total_entries ? info->total_entries : 1);

  const char *histogram = "";
  if (!access_only)
    {
      svn_stringbuf_t *text = svn_stringbuf_create_empty(result_pool);

      int i;
      int count = sizeof(info->histogram) / sizeof(info->histogram[0]);
      for (i = count - 1; i >= 0; --i)
        if (info->histogram[i] > 0 || text->len > 0)
          text = svn_stringbuf_createf(result_pool,
                                       i == count - 1
                                         ? "%s%12" APR_UINT64_T_FMT
                                           " buckets with >%d entries\n"
                                         : "%s%12" APR_UINT64_T_FMT
                                           " buckets with %d entries\n",
                                       text->data, info->histogram[i], i);

      histogram = text->data;
    }

  return access_only
       ? svn_string_createf(result_pool,
                            "%s\n"
                            "gets    : %" APR_UINT64_T_FMT
                            ", %" APR_UINT64_T_FMT " hits (%5.2f%%)\n"
                            "sets    : %" APR_UINT64_T_FMT
                            " (%5.2f%% of misses)\n",
                            info->id,
                            info->gets,
                            info->hits, hit_rate,
                            info->sets, write_rate)
       : svn_string_createf(result_pool,

                            "%s\n"
                            "gets    : %" APR_UINT64_T_FMT
                            ", %" APR_UINT64_T_FMT " hits (%5.2f%%)\n"
                            "sets    : %" APR_UINT64_T_FMT
                            " (%5.2f%% of misses)\n"
                            "failures: %" APR_UINT64_T_FMT "\n"
                            "used    : %" APR_UINT64_T_FMT " MB (%5.2f%%)"
                            " of %" APR_UINT64_T_FMT " MB data cache"
                            " / %" APR_UINT64_T_FMT " MB total cache memory\n"
                            "          %" APR_UINT64_T_FMT " entries (%5.2f%%)"
                            " of %" APR_UINT64_T_FMT " total\n%s",

                            info->id,

                            info->gets,
                            info->hits, hit_rate,
                            info->sets, write_rate,
                            info->failures,

                            info->used_size / _1MB, data_usage_rate,
                            info->data_size / _1MB,
                            info->total_size / _1MB,

                            info->used_entries, data_entry_rate,
                            info->total_entries,
                            histogram);
}