~ubuntu-branches/debian/sid/subversion/sid

« back to all changes in this revision

Viewing changes to subversion/libsvn_wc/wc_db_util.c

  • Committer: Package Import Robot
  • Author(s): James McCoy
  • Date: 2015-08-07 21:32:47 UTC
  • mfrom: (0.2.15) (4.1.7 experimental)
  • Revision ID: package-import@ubuntu.com-20150807213247-ozyewtmgsr6tkewl
Tags: 1.9.0-1
* Upload to unstable
* New upstream release.
  + Security fixes
    - CVE-2015-3184: Mixed anonymous/authenticated path-based authz with
      httpd 2.4
    - CVE-2015-3187: svn_repos_trace_node_locations() reveals paths hidden
      by authz
* Add >= 2.7 requirement for python-all-dev Build-Depends, needed to run
  tests.
* Remove Build-Conflicts against ruby-test-unit.  (Closes: #791844)
* Remove patches/apache_module_dependency in favor of expressing the
  dependencies in authz_svn.load/dav_svn.load.
* Build-Depend on apache2-dev (>= 2.4.16) to ensure ap_some_authn_required()
  is available when building mod_authz_svn and Depend on apache2-bin (>=
  2.4.16) for runtime support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
83
83
relpath_depth_sqlite(svn_sqlite__context_t *sctx,
84
84
                     int argc,
85
85
                     svn_sqlite__value_t *values[],
86
 
                     apr_pool_t *scratch_pool)
 
86
                     void *baton)
87
87
{
88
88
  const char *path = NULL;
89
89
  apr_int64_t depth;
115
115
                        const char *sdb_fname,
116
116
                        svn_sqlite__mode_t smode,
117
117
                        svn_boolean_t exclusive,
 
118
                        apr_int32_t timeout,
118
119
                        const char *const *my_statements,
119
120
                        apr_pool_t *result_pool,
120
121
                        apr_pool_t *scratch_pool)
139
140
 
140
141
  SVN_ERR(svn_sqlite__open(sdb, sdb_abspath, smode,
141
142
                           my_statements ? my_statements : statements,
142
 
                           0, NULL, result_pool, scratch_pool));
 
143
                           0, NULL, timeout, result_pool, scratch_pool));
143
144
 
144
145
  if (exclusive)
145
146
    SVN_ERR(svn_sqlite__exec_statements(*sdb, STMT_PRAGMA_LOCKING_MODE));
146
147
 
147
148
  SVN_ERR(svn_sqlite__create_scalar_function(*sdb, "relpath_depth", 1,
 
149
                                             TRUE /* deterministic */,
148
150
                                             relpath_depth_sqlite, NULL));
149
151
 
150
152
  return SVN_NO_ERROR;
151
153
}
152
154
 
153
 
 
154
 
/* Some helpful transaction helpers.
155
 
 
156
 
   Instead of directly using SQLite transactions, these wrappers
157
 
   relieve the consumer from the need to wrap the wcroot and
158
 
   local_relpath, which are almost always used within the transaction.
159
 
 
160
 
   This also means if we later want to implement some wc_db-specific txn
161
 
   handling, we have a convenient place to do it.
162
 
   */
163
 
 
164
 
/* A callback which supplies WCROOTs and LOCAL_RELPATHs. */
165
 
typedef svn_error_t *(*db_txn_callback_t)(void *baton,
166
 
                                          svn_wc__db_wcroot_t *wcroot,
167
 
                                          const char *local_relpath,
168
 
                                          apr_pool_t *scratch_pool);
169
 
 
170
 
/* Baton for use with run_txn() and with_db_txn(). */
171
 
struct txn_baton_t
172
 
{
173
 
  svn_wc__db_wcroot_t *wcroot;
174
 
  const char *local_relpath;
175
 
 
176
 
  db_txn_callback_t cb_func;
177
 
  void *cb_baton;
178
 
};
179
 
 
180
 
 
181
 
/* Unwrap the sqlite transaction into a wc_db txn.
182
 
   Implements svn_sqlite__transaction_callback_t. */
183
 
static svn_error_t *
184
 
run_txn(void *baton, svn_sqlite__db_t *db, apr_pool_t *scratch_pool)
185
 
{
186
 
  struct txn_baton_t *tb = baton;
187
 
 
188
 
  return svn_error_trace(
189
 
    tb->cb_func(tb->cb_baton, tb->wcroot, tb->local_relpath, scratch_pool));
190
 
}
191
 
 
192
 
 
193
 
/* Run CB_FUNC in a SQLite transaction with CB_BATON, using WCROOT and
194
 
   LOCAL_RELPATH.  If callbacks require additional information, they may
195
 
   provide it using CB_BATON. */
196
 
svn_error_t *
197
 
svn_wc__db_with_txn(svn_wc__db_wcroot_t *wcroot,
198
 
                    const char *local_relpath,
199
 
                    svn_wc__db_txn_callback_t cb_func,
200
 
                    void *cb_baton,
201
 
                    apr_pool_t *scratch_pool)
202
 
{
203
 
  struct txn_baton_t tb;
204
 
 
205
 
  tb.wcroot = wcroot;
206
 
  tb.local_relpath = local_relpath;
207
 
  tb.cb_func = cb_func;
208
 
  tb.cb_baton = cb_baton;
209
 
 
210
 
  return svn_error_trace(
211
 
    svn_sqlite__with_lock(wcroot->sdb, run_txn, &tb, scratch_pool));
212
 
}