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; }
void svn_cl__conflict_stats_resolved(svn_cl__conflict_stats_t *conflict_stats, const char *path_local, svn_wc_conflict_kind_t conflict_kind) { switch (conflict_kind) { case svn_wc_conflict_kind_text: if (svn_hash_gets(conflict_stats->text_conflicts, path_local)) { svn_hash_sets(conflict_stats->text_conflicts, path_local, NULL); conflict_stats->text_conflicts_resolved++; } break; case svn_wc_conflict_kind_property: if (svn_hash_gets(conflict_stats->prop_conflicts, path_local)) { svn_hash_sets(conflict_stats->prop_conflicts, path_local, NULL); conflict_stats->prop_conflicts_resolved++; } break; case svn_wc_conflict_kind_tree: if (svn_hash_gets(conflict_stats->tree_conflicts, path_local)) { svn_hash_sets(conflict_stats->tree_conflicts, path_local, NULL); conflict_stats->tree_conflicts_resolved++; } break; } }
static KWallet::Wallet * get_wallet(QString wallet_name, apr_hash_t *parameters) { KWallet::Wallet *wallet = static_cast<KWallet::Wallet *> (svn_hash_gets(parameters, "kwallet-wallet")); if (! wallet && ! svn_hash_gets(parameters, "kwallet-opening-failed")) { wallet = KWallet::Wallet::openWallet(wallet_name, get_wid(), KWallet::Wallet::Synchronous); if (wallet) { svn_hash_sets(parameters, "kwallet-wallet", wallet); apr_pool_cleanup_register(apr_hash_pool_get(parameters), parameters, kwallet_terminate, apr_pool_cleanup_null); svn_hash_sets(parameters, "kwallet-initialized", ""); } else { svn_hash_sets(parameters, "kwallet-opening-failed", ""); } } return wallet; }
/* * Implementation of svn_ra_serf__prop_func_t that delivers all DAV properties * in (const char * -> apr_hash_t *) on Namespace pointing to a second hash * (const char * -> svn_string_t *) to the values. */ static svn_error_t * deliver_node_props(void *baton, const char *path, const char *ns, const char *name, const svn_string_t *value, apr_pool_t *scratch_pool) { apr_hash_t *nss = baton; apr_hash_t *props; apr_pool_t *result_pool = apr_hash_pool_get(nss); props = svn_hash_gets(nss, ns); if (!props) { props = apr_hash_make(result_pool); ns = apr_pstrdup(result_pool, ns); svn_hash_sets(nss, ns, props); } name = apr_pstrdup(result_pool, name); svn_hash_sets(props, name, svn_string_dup(value, result_pool)); return SVN_NO_ERROR; }
svn_error_t * svn_repos_get_commit_editor4(const svn_delta_editor_t **editor, void **edit_baton, svn_repos_t *repos, svn_fs_txn_t *txn, const char *repos_url, const char *base_path, const char *user, const char *log_msg, svn_commit_callback2_t commit_callback, void *commit_baton, svn_repos_authz_callback_t authz_callback, void *authz_baton, apr_pool_t *pool) { apr_hash_t *revprop_table = apr_hash_make(pool); if (user) svn_hash_sets(revprop_table, SVN_PROP_REVISION_AUTHOR, svn_string_create(user, pool)); if (log_msg) svn_hash_sets(revprop_table, SVN_PROP_REVISION_LOG, svn_string_create(log_msg, pool)); return svn_repos_get_commit_editor5(editor, edit_baton, repos, txn, repos_url, base_path, revprop_table, commit_callback, commit_baton, authz_callback, authz_baton, pool); }
svn_error_t * svn_wc__db_close(svn_wc__db_t *db) { apr_pool_t *scratch_pool = db->state_pool; apr_hash_t *roots = apr_hash_make(scratch_pool); apr_hash_index_t *hi; /* Collect all the unique WCROOT structures, and empty out DIR_DATA. */ for (hi = apr_hash_first(scratch_pool, db->dir_data); hi; hi = apr_hash_next(hi)) { svn_wc__db_wcroot_t *wcroot = apr_hash_this_val(hi); const char *local_abspath = apr_hash_this_key(hi); if (wcroot->sdb) svn_hash_sets(roots, wcroot->abspath, wcroot); svn_hash_sets(db->dir_data, local_abspath, NULL); } /* Run the cleanup for each WCROOT. */ return svn_error_trace(svn_wc__db_close_many_wcroots(roots, db->state_pool, scratch_pool)); }
static apr_status_t kwallet_terminate(void *data) { apr_hash_t *parameters = static_cast<apr_hash_t *> (data); if (svn_hash_gets(parameters, "kwallet-initialized")) { KWallet::Wallet *wallet = get_wallet(NULL, parameters); delete wallet; svn_hash_sets(parameters, "kwallet-wallet", NULL); svn_hash_sets(parameters, "kwallet-initialized", NULL); } return APR_SUCCESS; }
svn_error_t * svn_config__get_default_config(apr_hash_t **cfg_hash, apr_pool_t *pool) { svn_config_t *empty_cfg; *cfg_hash = apr_hash_make(pool); SVN_ERR(svn_config_create2(&empty_cfg, FALSE, FALSE, pool)); svn_hash_sets(*cfg_hash, SVN_CONFIG_CATEGORY_CONFIG, empty_cfg); SVN_ERR(svn_config_create2(&empty_cfg, FALSE, FALSE, pool)); svn_hash_sets(*cfg_hash, SVN_CONFIG_CATEGORY_SERVERS, empty_cfg); return SVN_NO_ERROR; }
svn_error_t * svn_cl__conflict_stats_get_paths(apr_array_header_t **conflicted_paths, svn_cl__conflict_stats_t *conflict_stats, apr_pool_t *result_pool, apr_pool_t *scratch_pool) { int n_text = apr_hash_count(conflict_stats->text_conflicts); int n_prop = apr_hash_count(conflict_stats->prop_conflicts); int n_tree = apr_hash_count(conflict_stats->tree_conflicts); apr_hash_t *all_conflicts; *conflicted_paths = NULL; if (n_text == 0 && n_prop == 0 && n_tree == 0) return SVN_NO_ERROR; /* Use a hash table to ensure paths with multiple conflicts are * returned just once. */ all_conflicts = apr_hash_make(result_pool); if (n_text > 0) { apr_array_header_t *k_text; int i; SVN_ERR(svn_hash_keys(&k_text, conflict_stats->text_conflicts, scratch_pool)); for (i = 0; i < k_text->nelts; i++) { const char *path = APR_ARRAY_IDX(k_text, i, const char *); svn_hash_sets(all_conflicts, path, ""); } }
svn_error_t * svn_wc__db_drop_root(svn_wc__db_t *db, const char *local_abspath, apr_pool_t *scratch_pool) { svn_wc__db_wcroot_t *root_wcroot = svn_hash_gets(db->dir_data, local_abspath); apr_hash_index_t *hi; apr_status_t result; if (!root_wcroot) return SVN_NO_ERROR; if (strcmp(root_wcroot->abspath, local_abspath) != 0) return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL, _("'%s' is not a working copy root"), svn_dirent_local_style(local_abspath, scratch_pool)); for (hi = apr_hash_first(scratch_pool, db->dir_data); hi; hi = apr_hash_next(hi)) { svn_wc__db_wcroot_t *wcroot = apr_hash_this_val(hi); if (wcroot == root_wcroot) svn_hash_sets(db->dir_data, apr_hash_this_key(hi), NULL); } result = apr_pool_cleanup_run(db->state_pool, root_wcroot, close_wcroot); if (result != APR_SUCCESS) return svn_error_wrap_apr(result, NULL); return SVN_NO_ERROR; }
/* Called whenever we find an <open> tag of some kind. */ static void handle_start_tag(void *userData, const char *tagname, const char **atts) { struct entries_accumulator *accum = userData; apr_hash_t *attributes; svn_wc_entry_t *entry; svn_error_t *err; /* We only care about the `entry' tag; all other tags, such as `xml' and `wc-entries', are ignored. */ if (strcmp(tagname, ENTRIES_TAG_ENTRY)) return; svn_pool_clear(accum->scratch_pool); /* Make an entry from the attributes. */ attributes = svn_xml_make_att_hash(atts, accum->scratch_pool); err = atts_to_entry(&entry, attributes, accum->pool); if (err) { svn_xml_signal_bailout(err, accum->parser); return; } /* Find the name and set up the entry under that name. This should *NOT* be NULL, since svn_wc__atts_to_entry() should have made it into SVN_WC_ENTRY_THIS_DIR. */ svn_hash_sets(accum->entries, entry->name, entry); }
/* Normalize the encoding and line ending style of the values of properties * in REV_PROPS that "need translation" (according to * svn_prop_needs_translation(), which is currently all svn:* props) so that * they are encoded in UTF-8 and contain only LF (\n) line endings. * * The number of properties that needed line ending normalization is returned in * *NORMALIZED_COUNT. * * No re-encoding is performed if SOURCE_PROP_ENCODING is NULL. */ svn_error_t * svnsync_normalize_revprops(apr_hash_t *rev_props, int *normalized_count, const char *source_prop_encoding, apr_pool_t *pool) { apr_hash_index_t *hi; *normalized_count = 0; for (hi = apr_hash_first(pool, rev_props); hi; hi = apr_hash_next(hi)) { const char *propname = apr_hash_this_key(hi); const svn_string_t *propval = apr_hash_this_val(hi); if (svn_prop_needs_translation(propname)) { svn_boolean_t was_normalized; SVN_ERR(normalize_string(&propval, &was_normalized, source_prop_encoding, pool, pool)); /* Replace the existing prop value. */ svn_hash_sets(rev_props, propname, propval); if (was_normalized) (*normalized_count)++; /* Count it. */ } } return SVN_NO_ERROR; }
static svn_error_t * file_change_prop(void *file_baton, const char *name, const svn_string_t *value, apr_pool_t *scratch_pool) { struct file_baton_t *fb = file_baton; svn_prop_kind_t prop_kind; prop_kind = svn_property_kind2(name); if (prop_kind != svn_prop_regular_kind || ! strcmp(name, SVN_PROP_MERGEINFO)) { /* We can't handle DAV, ENTRY and merge specific props here */ return SVN_NO_ERROR; } /* We store all properties in the hash for immediate addition with the svn_wc_add_from_disk3() call */ if (! fb->properties) fb->properties = apr_hash_make(fb->pool); if (value != NULL) svn_hash_sets(fb->properties, apr_pstrdup(fb->pool, name), svn_string_dup(value, fb->pool)); return SVN_NO_ERROR; }
/* ### FIXME: Consider somehow sharing code with ### libsvn_repos/load-fs-vtable.c:prefix_mergeinfo_paths() */ static svn_error_t * prefix_mergeinfo_paths(svn_string_t **mergeinfo_val, const svn_string_t *mergeinfo_orig, const char *parent_dir, apr_pool_t *pool) { apr_hash_t *prefixed_mergeinfo, *mergeinfo; apr_hash_index_t *hi; void *rangelist; SVN_ERR(svn_mergeinfo_parse(&mergeinfo, mergeinfo_orig->data, pool)); prefixed_mergeinfo = apr_hash_make(pool); for (hi = apr_hash_first(pool, mergeinfo); hi; hi = apr_hash_next(hi)) { const void *key; const char *path, *merge_source; apr_hash_this(hi, &key, NULL, &rangelist); merge_source = svn_relpath_canonicalize(key, pool); /* The svn:mergeinfo property syntax demands a repos abspath */ path = svn_fspath__canonicalize(svn_relpath_join(parent_dir, merge_source, pool), pool); svn_hash_sets(prefixed_mergeinfo, path, rangelist); } return svn_mergeinfo_to_string(mergeinfo_val, prefixed_mergeinfo, pool); }
static svn_error_t * get_ra_editor(const svn_delta_editor_t **editor, void **edit_baton, svn_ra_session_t *ra_session, svn_client_ctx_t *ctx, const char *log_msg, const apr_array_header_t *commit_items, const apr_hash_t *revprop_table, apr_hash_t *lock_tokens, svn_boolean_t keep_locks, svn_commit_callback2_t commit_callback, void *commit_baton, apr_pool_t *pool) { apr_hash_t *commit_revprops; apr_hash_t *relpath_map = NULL; SVN_ERR(svn_client__ensure_revprop_table(&commit_revprops, revprop_table, log_msg, ctx, pool)); #ifdef ENABLE_EV2_SHIMS if (commit_items) { int i; apr_pool_t *iterpool = svn_pool_create(pool); relpath_map = apr_hash_make(pool); for (i = 0; i < commit_items->nelts; i++) { svn_client_commit_item3_t *item = APR_ARRAY_IDX(commit_items, i, svn_client_commit_item3_t *); const char *relpath; if (!item->path) continue; svn_pool_clear(iterpool); SVN_ERR(svn_wc__node_get_origin(NULL, NULL, &relpath, NULL, NULL, NULL, NULL, ctx->wc_ctx, item->path, FALSE, pool, iterpool)); if (relpath) svn_hash_sets(relpath_map, relpath, item->path); } svn_pool_destroy(iterpool); } #endif /* Fetch RA commit editor. */ SVN_ERR(svn_ra__register_editor_shim_callbacks(ra_session, svn_client__get_shim_callbacks(ctx->wc_ctx, relpath_map, pool))); SVN_ERR(svn_ra_get_commit_editor3(ra_session, editor, edit_baton, commit_revprops, commit_callback, commit_baton, lock_tokens, keep_locks, pool)); return SVN_NO_ERROR; }
svn_error_t * svn_repos_fs_revision_proplist(apr_hash_t **table_p, svn_repos_t *repos, svn_revnum_t rev, svn_repos_authz_func_t authz_read_func, void *authz_read_baton, apr_pool_t *pool) { svn_repos_revision_access_level_t readability; SVN_ERR(svn_repos_check_revision_access(&readability, repos, rev, authz_read_func, authz_read_baton, pool)); if (readability == svn_repos_revision_access_none) { /* Return an empty hash. */ *table_p = apr_hash_make(pool); } else if (readability == svn_repos_revision_access_partial) { apr_hash_t *tmphash; svn_string_t *value; /* Produce two property hashtables, both in POOL. */ SVN_ERR(svn_fs_revision_proplist(&tmphash, repos->fs, rev, pool)); *table_p = apr_hash_make(pool); /* If they exist, we only copy svn:author and svn:date into the 'real' hashtable being returned. */ value = svn_hash_gets(tmphash, SVN_PROP_REVISION_AUTHOR); if (value) svn_hash_sets(*table_p, SVN_PROP_REVISION_AUTHOR, value); value = svn_hash_gets(tmphash, SVN_PROP_REVISION_DATE); if (value) svn_hash_sets(*table_p, SVN_PROP_REVISION_DATE, value); } else /* wholly readable revision */ { SVN_ERR(svn_fs_revision_proplist(table_p, repos->fs, rev, pool)); } return SVN_NO_ERROR; }
svn_error_t * svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p, svn_repos_t *repos, svn_revnum_t rev, const char *author, const char *log_msg, apr_pool_t *pool) { apr_hash_t *revprop_table = apr_hash_make(pool); if (author) svn_hash_sets(revprop_table, SVN_PROP_REVISION_AUTHOR, svn_string_create(author, pool)); if (log_msg) svn_hash_sets(revprop_table, SVN_PROP_REVISION_LOG, svn_string_create(log_msg, pool)); return svn_repos_fs_begin_txn_for_commit2(txn_p, repos, rev, revprop_table, pool); }
svn_error_t * svn_config_get_config(apr_hash_t **cfg_hash, const char *config_dir, apr_pool_t *pool) { svn_config_t *cfg; *cfg_hash = apr_hash_make(pool); SVN_ERR(get_category_config(&cfg, config_dir, SVN_CONFIG_CATEGORY_SERVERS, pool)); svn_hash_sets(*cfg_hash, SVN_CONFIG_CATEGORY_SERVERS, cfg); SVN_ERR(get_category_config(&cfg, config_dir, SVN_CONFIG_CATEGORY_CONFIG, pool)); svn_hash_sets(*cfg_hash, SVN_CONFIG_CATEGORY_CONFIG, cfg); return SVN_NO_ERROR; }
/* An implementation of svn_config_enumerator2_t. * Set environment variable NAME to value VALUE in the environment for * all hooks (in case the current section is the default section), * or the hook with the name corresponding to the current section's name. */ static svn_boolean_t parse_hooks_env_option(const char *name, const char *value, void *baton, apr_pool_t *pool) { struct parse_hooks_env_option_baton *bo = baton; apr_pool_t *result_pool = apr_hash_pool_get(bo->hooks_env); apr_hash_t *hook_env; hook_env = svn_hash_gets(bo->hooks_env, bo->section); if (hook_env == NULL) { hook_env = apr_hash_make(result_pool); svn_hash_sets(bo->hooks_env, apr_pstrdup(result_pool, bo->section), hook_env); } svn_hash_sets(hook_env, apr_pstrdup(result_pool, name), apr_pstrdup(result_pool, value)); return TRUE; }
static svn_error_t * svn_dso_load_internal(apr_dso_handle_t **dso, const char *fname) { *dso = svn_hash_gets(dso_cache, fname); /* First check to see if we've been through this before... We do this to avoid calling apr_dso_load multiple times for a given library, which would result in wasting small amounts of memory each time. */ if (*dso == NOT_THERE) { *dso = NULL; return SVN_NO_ERROR; } /* If we got nothing back from the cache, try and load the library. */ if (! *dso) { apr_status_t status = apr_dso_load(dso, fname, dso_pool); if (status) { #ifdef SVN_DEBUG_DSO char buf[1024]; fprintf(stderr, "Dynamic loading of '%s' failed with the following error:\n%s\n", fname, apr_dso_error(*dso, buf, 1024)); #endif *dso = NULL; /* It wasn't found, so set the special "we didn't find it" value. */ svn_hash_sets(dso_cache, apr_pstrdup(dso_pool, fname), NOT_THERE); return SVN_NO_ERROR; } /* Stash the dso so we can use it next time. */ svn_hash_sets(dso_cache, apr_pstrdup(dso_pool, fname), *dso); } return SVN_NO_ERROR; }
svn_error_t * svn_config_write_auth_data(apr_hash_t *hash, const char *cred_kind, const char *realmstring, const char *config_dir, apr_pool_t *pool) { apr_file_t *authfile = NULL; svn_stream_t *stream; const char *auth_path; SVN_ERR(svn_auth__file_path(&auth_path, cred_kind, realmstring, config_dir, pool)); if (! auth_path) return svn_error_create(SVN_ERR_NO_AUTH_FILE_PATH, NULL, _("Unable to locate auth file")); /* Add the realmstring to the hash, so programs (or users) can verify exactly which set of credentials this file holds. */ svn_hash_sets(hash, SVN_CONFIG_REALMSTRING_KEY, svn_string_create(realmstring, pool)); SVN_ERR_W(svn_io_file_open(&authfile, auth_path, (APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BUFFERED), APR_OS_DEFAULT, pool), _("Unable to open auth file for writing")); stream = svn_stream_from_aprfile2(authfile, FALSE, pool); SVN_ERR_W(svn_hash_write2(hash, stream, SVN_HASH_TERMINATOR, pool), apr_psprintf(pool, _("Error writing hash to '%s'"), svn_dirent_local_style(auth_path, pool))); SVN_ERR(svn_stream_close(stream)); /* To be nice, remove the realmstring from the hash again, just in case the caller wants their hash unchanged. */ svn_hash_sets(hash, SVN_CONFIG_REALMSTRING_KEY, NULL); return SVN_NO_ERROR; }
svn_error_t * svn_config_write_auth_data(apr_hash_t *hash, const char *cred_kind, const char *realmstring, const char *config_dir, apr_pool_t *pool) { svn_stream_t *stream; const char *auth_path, *tmp_path; SVN_ERR(svn_auth__file_path(&auth_path, cred_kind, realmstring, config_dir, pool)); if (! auth_path) return svn_error_create(SVN_ERR_NO_AUTH_FILE_PATH, NULL, _("Unable to locate auth file")); /* Add the realmstring to the hash, so programs (or users) can verify exactly which set of credentials this file holds. ### What if realmstring key is already in the hash? */ svn_hash_sets(hash, SVN_CONFIG_REALMSTRING_KEY, svn_string_create(realmstring, pool)); SVN_ERR_W(svn_stream_open_unique(&stream, &tmp_path, svn_dirent_dirname(auth_path, pool), svn_io_file_del_on_pool_cleanup, pool, pool), _("Unable to open auth file for writing")); SVN_ERR_W(svn_hash_write2(hash, stream, SVN_HASH_TERMINATOR, pool), apr_psprintf(pool, _("Error writing hash to '%s'"), svn_dirent_local_style(auth_path, pool))); SVN_ERR(svn_stream_close(stream)); SVN_ERR(svn_io_file_rename2(tmp_path, auth_path, FALSE, pool)); /* To be nice, remove the realmstring from the hash again, just in case the caller wants their hash unchanged. ### Should we also do this when a write error occurs? */ svn_hash_sets(hash, SVN_CONFIG_REALMSTRING_KEY, NULL); return SVN_NO_ERROR; }
/* Set PROPS for NS:NAME VAL. Helper for propfind_closed */ static void set_ns_prop(apr_hash_t *ns_props, const char *ns, const char *name, const svn_string_t *val, apr_pool_t *result_pool) { apr_hash_t *props = svn_hash_gets(ns_props, ns); if (!props) { props = apr_hash_make(result_pool); ns = apr_pstrdup(result_pool, ns); svn_hash_sets(ns_props, ns, props); } if (val) { name = apr_pstrdup(result_pool, name); val = svn_string_dup(val, result_pool); } svn_hash_sets(props, name, val); }
/* Convert an old-style svn_subst_keywords_t struct * into a new-style * keywords hash. Keyword values are shallow copies, so the produced * hash must not be assumed to have lifetime longer than the struct it * is based on. A NULL input causes a NULL output. */ static apr_hash_t * kwstruct_to_kwhash(const svn_subst_keywords_t *kwstruct, apr_pool_t *pool) { apr_hash_t *kwhash; if (kwstruct == NULL) return NULL; kwhash = apr_hash_make(pool); if (kwstruct->revision) { svn_hash_sets(kwhash, SVN_KEYWORD_REVISION_LONG, kwstruct->revision); svn_hash_sets(kwhash, SVN_KEYWORD_REVISION_MEDIUM, kwstruct->revision); svn_hash_sets(kwhash, SVN_KEYWORD_REVISION_SHORT, kwstruct->revision); } if (kwstruct->date) { svn_hash_sets(kwhash, SVN_KEYWORD_DATE_LONG, kwstruct->date); svn_hash_sets(kwhash, SVN_KEYWORD_DATE_SHORT, kwstruct->date); } if (kwstruct->author) { svn_hash_sets(kwhash, SVN_KEYWORD_AUTHOR_LONG, kwstruct->author); svn_hash_sets(kwhash, SVN_KEYWORD_AUTHOR_SHORT, kwstruct->author); } if (kwstruct->url) { svn_hash_sets(kwhash, SVN_KEYWORD_URL_LONG, kwstruct->url); svn_hash_sets(kwhash, SVN_KEYWORD_URL_SHORT, kwstruct->url); } if (kwstruct->id) { svn_hash_sets(kwhash, SVN_KEYWORD_ID, kwstruct->id); } return kwhash; }
/* Removes all non regular properties from PROPS */ void svn_ra_serf__keep_only_regular_props(apr_hash_t *props, apr_pool_t *scratch_pool) { apr_hash_index_t *hi; for (hi = apr_hash_first(scratch_pool, props); hi; hi = apr_hash_next(hi)) { const char *propname = apr_hash_this_key(hi); if (svn_property_kind2(propname) != svn_prop_regular_kind) svn_hash_sets(props, propname, NULL); } }
svn_error_t * svn_editor_add_directory(svn_editor_t *editor, const char *relpath, const apr_array_header_t *children, apr_hash_t *props, svn_revnum_t replaces_rev) { svn_error_t *err = SVN_NO_ERROR; SVN_ERR_ASSERT(svn_relpath_is_canonical(relpath)); SVN_ERR_ASSERT(children != NULL); SVN_ERR_ASSERT(props != NULL); /* ### validate children are just basenames? */ SHOULD_NOT_BE_FINISHED(editor); SHOULD_ALLOW_ADD(editor, relpath); VERIFY_PARENT_MAY_EXIST(editor, relpath); CHECK_UNKNOWN_CHILD(editor, relpath); SVN_ERR(check_cancel(editor)); if (editor->funcs.cb_add_directory) { START_CALLBACK(editor); err = editor->funcs.cb_add_directory(editor->baton, relpath, children, props, replaces_rev, editor->scratch_pool); END_CALLBACK(editor); } MARK_ADDED_DIR(editor, relpath); MARK_PARENT_STABLE(editor, relpath); CLEAR_INCOMPLETE(editor, relpath); #ifdef ENABLE_ORDERING_CHECK { int i; for (i = 0; i < children->nelts; i++) { const char *child_basename = APR_ARRAY_IDX(children, i, const char *); const char *child = svn_relpath_join(relpath, child_basename, editor->state_pool); svn_hash_sets(editor->pending_incomplete_children, child, ""); } } #endif svn_pool_clear(editor->scratch_pool); return svn_error_trace(err); }
dav_error * dav_svn__create_txn(dav_svn_repos *repos, const char **ptxn_name, apr_hash_t *revprops, apr_pool_t *pool) { svn_revnum_t rev; svn_fs_txn_t *txn; svn_error_t *serr; if (! revprops) { revprops = apr_hash_make(pool); } if (repos->username) { svn_hash_sets(revprops, SVN_PROP_REVISION_AUTHOR, svn_string_create(repos->username, pool)); } serr = dav_svn__get_youngest_rev(&rev, repos, pool); if (serr != NULL) { return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR, "could not determine youngest revision", repos->pool); } serr = svn_repos_fs_begin_txn_for_commit2(&txn, repos->repos, rev, revprops, repos->pool); if (serr != NULL) { return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR, "could not begin a transaction", repos->pool); } serr = svn_fs_txn_name(ptxn_name, txn, pool); if (serr != NULL) { return dav_svn__convert_err(serr, HTTP_INTERNAL_SERVER_ERROR, "could not fetch transaction name", repos->pool); } return NULL; }
/* This implements the svn_auth__password_set_t interface. Store PASSPHRASE in CREDS; ignore other parameters. */ svn_error_t * svn_auth__ssl_client_cert_pw_set(svn_boolean_t *done, apr_hash_t *creds, const char *realmstring, const char *username, const char *passphrase, apr_hash_t *parameters, svn_boolean_t non_interactive, apr_pool_t *pool) { svn_hash_sets(creds, AUTHN_PASSPHRASE_KEY, svn_string_create(passphrase, pool)); *done = TRUE; return SVN_NO_ERROR; }
apr_hash_t * svn_prop_array_to_hash(const apr_array_header_t *properties, apr_pool_t *pool) { int i; apr_hash_t *prop_hash = apr_hash_make(pool); for (i = 0; i < properties->nelts; i++) { const svn_prop_t *prop = &APR_ARRAY_IDX(properties, i, svn_prop_t); svn_hash_sets(prop_hash, prop->name, prop->value); } return prop_hash; }
/* Conforms to svn_ra_serf__xml_closed_t */ static svn_error_t * mergeinfo_closed(svn_ra_serf__xml_estate_t *xes, void *baton, int leaving_state, const svn_string_t *cdata, apr_hash_t *attrs, apr_pool_t *scratch_pool) { mergeinfo_context_t *mergeinfo_ctx = baton; if (leaving_state == MERGEINFO_ITEM) { /* Placed here from the child elements. */ const char *path = svn_hash_gets(attrs, "path"); const char *info = svn_hash_gets(attrs, "info"); if (path != NULL && info != NULL) { svn_mergeinfo_t path_mergeinfo; /* Correct for naughty servers that send "relative" paths with leading slashes! */ if (path[0] == '/') ++path; SVN_ERR(svn_mergeinfo_parse(&path_mergeinfo, info, mergeinfo_ctx->pool)); svn_hash_sets(mergeinfo_ctx->result_catalog, apr_pstrdup(mergeinfo_ctx->pool, path), path_mergeinfo); } } else { SVN_ERR_ASSERT(leaving_state == MERGEINFO_PATH || leaving_state == MERGEINFO_INFO); /* Stash the value onto the parent MERGEINFO_ITEM. */ svn_ra_serf__xml_note(xes, MERGEINFO_ITEM, leaving_state == MERGEINFO_PATH ? "path" : "info", cdata->data); } return SVN_NO_ERROR; }