static svn_error_t * add_file_or_directory(const char *file_or_directory, const char *path, edit_baton_t *eb, const char *copyfrom_path, svn_revnum_t copyfrom_rev, apr_pool_t *pool, void **added_baton) { const char *qname = apr_xml_quote_string(pool, path, 1); const char *qcopy = copyfrom_path ? apr_xml_quote_string(pool, copyfrom_path, 1) : NULL; SVN_ERR(maybe_close_textdelta(eb)); *added_baton = eb; if (! copyfrom_path) SVN_ERR(dav_svn__brigade_printf(eb->bb, eb->output, "<S:add-%s name=\"%s\"/>" DEBUG_CR, file_or_directory, qname)); else SVN_ERR(dav_svn__brigade_printf(eb->bb, eb->output, "<S:add-%s name=\"%s\" " "copyfrom-path=\"%s\" " "copyfrom-rev=\"%ld\"/>" DEBUG_CR, file_or_directory, qname, qcopy, copyfrom_rev)); return SVN_NO_ERROR; }
static svn_error_t * change_file_or_dir_prop(const char *file_or_dir, edit_baton_t *eb, const char *name, const svn_string_t *value, apr_pool_t *pool) { const char *qname = apr_xml_quote_string(pool, name, 1); SVN_ERR(maybe_close_textdelta(eb)); if (value) { const svn_string_t *enc_value = svn_base64_encode_string(value, pool); SVN_ERR(dav_svn__send_xml (eb->bb, eb->output, "<S:change-%s-prop name=\"%s\">%s</S:change-%s-prop>" DEBUG_CR, file_or_dir, qname, enc_value->data, file_or_dir)); } else { SVN_ERR(dav_svn__send_xml (eb->bb, eb->output, "<S:change-%s-prop name=\"%s\" del=\"true\"/>" DEBUG_CR, file_or_dir, qname)); } return SVN_NO_ERROR; }
static svn_error_t * delete_entry(const char *path, svn_revnum_t revision, void *parent_baton, apr_pool_t *pool) { edit_baton_t *eb = parent_baton; const char *qname = apr_xml_quote_string(pool, path, 1); SVN_ERR(maybe_close_textdelta(eb)); return dav_svn__send_xml(eb->bb, eb->output, "<S:delete-entry name=\"%s\" rev=\"%ld\"/>" DEBUG_CR, qname, revision); }
static svn_error_t * close_file(void *file_baton, const char *text_checksum, apr_pool_t *pool) { edit_baton_t *eb = file_baton; SVN_ERR(maybe_close_textdelta(eb)); SVN_ERR(dav_svn__send_xml(eb->bb, eb->output, "<S:close-file")); if (text_checksum) SVN_ERR(dav_svn__send_xml(eb->bb, eb->output, " checksum=\"%s\"/>" DEBUG_CR, text_checksum)); else SVN_ERR(dav_svn__send_xml(eb->bb, eb->output, "/>" DEBUG_CR)); return SVN_NO_ERROR; }
static svn_error_t * open_file_or_directory(const char *file_or_directory, const char *path, edit_baton_t *eb, svn_revnum_t base_revision, apr_pool_t *pool, void **opened_baton) { const char *qname = apr_xml_quote_string(pool, path, 1); SVN_ERR(maybe_close_textdelta(eb)); *opened_baton = (void *)eb; return dav_svn__send_xml(eb->bb, eb->output, "<S:open-%s name=\"%s\" rev=\"%ld\"/>" DEBUG_CR, file_or_directory, qname, base_revision); }
static svn_error_t * change_file_or_dir_prop(const char *file_or_dir, edit_baton_t *eb, const char *name, const svn_string_t *value, apr_pool_t *pool) { const char *qname = apr_xml_quote_string(pool, name, 1); SVN_ERR(maybe_close_textdelta(eb)); if (value) { const svn_string_t *enc_value = svn_base64_encode_string2(value, TRUE, pool); /* Some versions of apr_brigade_vprintf() have a buffer overflow bug that can be triggered by just the wrong size of a large property value. The bug has been fixed (see http://svn.apache.org/viewvc?view=rev&revision=768417), but we need a workaround for the buggy APR versions, so we write our potentially large block of property data using a different underlying function. */ SVN_ERR(dav_svn__brigade_printf(eb->bb, eb->output, "<S:change-%s-prop name=\"%s\">", file_or_dir, qname)); SVN_ERR(dav_svn__brigade_write(eb->bb, eb->output, enc_value->data, enc_value->len)); SVN_ERR(dav_svn__brigade_printf(eb->bb, eb->output, "</S:change-%s-prop>" DEBUG_CR, file_or_dir)); } else { SVN_ERR(dav_svn__brigade_printf (eb->bb, eb->output, "<S:change-%s-prop name=\"%s\" del=\"true\"/>" DEBUG_CR, file_or_dir, qname)); } return SVN_NO_ERROR; }