Example #1
0
svn_error_t *
svn_skel__parse_iprops(apr_array_header_t **iprops,
                       const svn_skel_t *skel,
                       apr_pool_t *result_pool)
{
  svn_skel_t *elt;

  /* Validate the skel. */
  if (! is_valid_iproplist_skel(skel))
    return skel_err("iprops");

  /* Create the returned structure */
  *iprops = apr_array_make(result_pool, 1,
                           sizeof(svn_prop_inherited_item_t *));

  for (elt = skel->children; elt; elt = elt->next->next)
    {
      svn_prop_inherited_item_t *new_iprop = apr_palloc(result_pool,
                                                        sizeof(*new_iprop));
      svn_string_t *repos_parent = svn_string_ncreate(elt->data, elt->len,
                                                      result_pool);
      SVN_ERR(svn_skel__parse_proplist(&(new_iprop->prop_hash), elt->next,
                                       result_pool));
      new_iprop->path_or_url = repos_parent->data;
      APR_ARRAY_PUSH(*iprops, svn_prop_inherited_item_t *) = new_iprop;
    }
  return SVN_NO_ERROR;
}
/* Parse SKEL_CSTR according to the description in USAGE_MSG. */
static svn_error_t *
extract_values_from_skel(svn_string_t **old_propval_p,
                         svn_string_t **propval_p,
                         const char *skel_cstr,
                         apr_pool_t *pool)
{
  apr_hash_t *proplist;
  svn_skel_t *skel;

  skel = svn_skel__parse(skel_cstr, strlen(skel_cstr), pool);
  SVN_ERR(svn_skel__parse_proplist(&proplist, skel, pool));
  *old_propval_p = apr_hash_get(proplist, KEY_OLD_PROPVAL, APR_HASH_KEY_STRING);
  *propval_p = apr_hash_get(proplist, KEY_NEW_PROPVAL, APR_HASH_KEY_STRING);

  return SVN_NO_ERROR;
}
Example #3
0
/* Respond to a "create-txn-with-props" POST request.
 *
 * Syntax:  ( create-txn-with-props (PROPNAME PROPVAL [PROPNAME PROPVAL ...])
 */
dav_error *
dav_svn__post_create_txn_with_props(const dav_resource *resource,
                                    svn_skel_t *request_skel,
                                    ap_filter_t *output)
{
  const char *txn_name;
  const char *vtxn_name;
  dav_error *derr;
  svn_error_t *err;
  request_rec *r = resource->info->r;
  apr_hash_t *revprops;
  svn_skel_t *proplist_skel = request_skel->children->next;

  if ((err = svn_skel__parse_proplist(&revprops, proplist_skel,
                                      resource->pool)))
    {
      return dav_svn__convert_err(err, HTTP_BAD_REQUEST,
                                  "Malformatted request skel", resource->pool);
    }

  /* Create a Subversion repository transaction based on HEAD. */
  if ((derr = dav_svn__create_txn(resource->info->repos, &txn_name,
                                  revprops, resource->pool)))
    return derr;

  /* Build a "201 Created" response with header that tells the
     client our new transaction's name. */
  vtxn_name = apr_table_get(r->headers_in, SVN_DAV_VTXN_NAME_HEADER);
  if (vtxn_name && vtxn_name[0])
    {
      /* If the client supplied a vtxn name then store a mapping from
         the client name to the FS transaction name in the activity
         database. */
      if ((derr  = dav_svn__store_activity(resource->info->repos,
                                           vtxn_name, txn_name)))
        return derr;
      apr_table_set(r->headers_out, SVN_DAV_VTXN_NAME_HEADER, vtxn_name);
    }
  else
    apr_table_set(r->headers_out, SVN_DAV_TXN_NAME_HEADER, txn_name);

  r->status = HTTP_CREATED;

  return NULL;
}
Example #4
0
svn_error_t *
svn_sqlite__column_properties(apr_hash_t **props,
                              svn_sqlite__stmt_t *stmt,
                              int column,
                              apr_pool_t *result_pool,
                              apr_pool_t *scratch_pool)
{
  apr_size_t len;
  const void *val;

  /* svn_skel__parse_proplist copies everything needed to result_pool */
  val = svn_sqlite__column_blob(stmt, column, &len, NULL);
  if (val == NULL)
    {
      *props = NULL;
      return SVN_NO_ERROR;
    }

  SVN_ERR(svn_skel__parse_proplist(props,
                                   svn_skel__parse(val, len, scratch_pool),
                                   result_pool));

  return SVN_NO_ERROR;
}