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

« back to all changes in this revision

Viewing changes to subversion/libsvn_fs_fs/transaction.h

  • 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:
 
1
/* transaction.h --- transaction-related functions of FSFS
 
2
 *
 
3
 * ====================================================================
 
4
 *    Licensed to the Apache Software Foundation (ASF) under one
 
5
 *    or more contributor license agreements.  See the NOTICE file
 
6
 *    distributed with this work for additional information
 
7
 *    regarding copyright ownership.  The ASF licenses this file
 
8
 *    to you under the Apache License, Version 2.0 (the
 
9
 *    "License"); you may not use this file except in compliance
 
10
 *    with the License.  You may obtain a copy of the License at
 
11
 *
 
12
 *      http://www.apache.org/licenses/LICENSE-2.0
 
13
 *
 
14
 *    Unless required by applicable law or agreed to in writing,
 
15
 *    software distributed under the License is distributed on an
 
16
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 
17
 *    KIND, either express or implied.  See the License for the
 
18
 *    specific language governing permissions and limitations
 
19
 *    under the License.
 
20
 * ====================================================================
 
21
 */
 
22
 
 
23
#ifndef SVN_LIBSVN_FS__TRANSACTION_H
 
24
#define SVN_LIBSVN_FS__TRANSACTION_H
 
25
 
 
26
#include "fs.h"
 
27
 
 
28
/* Return the transaction ID of TXN.
 
29
 */
 
30
const svn_fs_fs__id_part_t *
 
31
svn_fs_fs__txn_get_id(svn_fs_txn_t *txn);
 
32
 
 
33
/* Store NODEREV as the node-revision for the node whose id is ID in
 
34
   FS, after setting its is_fresh_txn_root to FRESH_TXN_ROOT.  Do any
 
35
   necessary temporary allocation in POOL. */
 
36
svn_error_t *
 
37
svn_fs_fs__put_node_revision(svn_fs_t *fs,
 
38
                             const svn_fs_id_t *id,
 
39
                             node_revision_t *noderev,
 
40
                             svn_boolean_t fresh_txn_root,
 
41
                             apr_pool_t *pool);
 
42
 
 
43
/* Find the paths which were changed in transaction TXN_ID of
 
44
   filesystem FS and store them in *CHANGED_PATHS_P.
 
45
   Get any temporary allocations from POOL. */
 
46
svn_error_t *
 
47
svn_fs_fs__txn_changes_fetch(apr_hash_t **changed_paths_p,
 
48
                             svn_fs_t *fs,
 
49
                             const svn_fs_fs__id_part_t *txn_id,
 
50
                             apr_pool_t *pool);
 
51
 
 
52
/* Find the paths which were changed in revision REV of filesystem FS
 
53
   and store them in *CHANGED_PATHS_P.  Get any temporary allocations
 
54
   from POOL. */
 
55
svn_error_t *
 
56
svn_fs_fs__paths_changed(apr_hash_t **changed_paths_p,
 
57
                         svn_fs_t *fs,
 
58
                         svn_revnum_t rev,
 
59
                         apr_pool_t *pool);
 
60
 
 
61
/* Create a new transaction in filesystem FS, based on revision REV,
 
62
   and store it in *TXN_P.  Allocate all necessary variables from
 
63
   POOL. */
 
64
svn_error_t *
 
65
svn_fs_fs__create_txn(svn_fs_txn_t **txn_p,
 
66
                      svn_fs_t *fs,
 
67
                      svn_revnum_t rev,
 
68
                      apr_pool_t *pool);
 
69
 
 
70
/* Set the transaction property NAME to the value VALUE in transaction
 
71
   TXN.  Perform temporary allocations from POOL. */
 
72
svn_error_t *
 
73
svn_fs_fs__change_txn_prop(svn_fs_txn_t *txn,
 
74
                           const char *name,
 
75
                           const svn_string_t *value,
 
76
                           apr_pool_t *pool);
 
77
 
 
78
/* Change transaction properties in transaction TXN based on PROPS.
 
79
   Perform temporary allocations from POOL. */
 
80
svn_error_t *
 
81
svn_fs_fs__change_txn_props(svn_fs_txn_t *txn,
 
82
                            const apr_array_header_t *props,
 
83
                            apr_pool_t *pool);
 
84
 
 
85
/* Store a transaction record in *TXN_P for the transaction identified
 
86
   by TXN_ID in filesystem FS.  Allocate everything from POOL. */
 
87
svn_error_t *
 
88
svn_fs_fs__get_txn(transaction_t **txn_p,
 
89
                   svn_fs_t *fs,
 
90
                   const svn_fs_fs__id_part_t *txn_id,
 
91
                   apr_pool_t *pool);
 
92
 
 
93
/* Return the next available copy_id in *COPY_ID for the transaction
 
94
   TXN_ID in filesystem FS.  Allocate space in POOL. */
 
95
svn_error_t *
 
96
svn_fs_fs__reserve_copy_id(svn_fs_fs__id_part_t *copy_id_p,
 
97
                           svn_fs_t *fs,
 
98
                           const svn_fs_fs__id_part_t *txn_id,
 
99
                           apr_pool_t *pool);
 
100
 
 
101
/* Create an entirely new mutable node in the filesystem FS, whose
 
102
   node-revision is NODEREV.  Set *ID_P to the new node revision's ID.
 
103
   Use POOL for any temporary allocation.  COPY_ID is the copy_id to
 
104
   use in the node revision ID.  TXN_ID is the Subversion transaction
 
105
   under which this occurs. */
 
106
svn_error_t *
 
107
svn_fs_fs__create_node(const svn_fs_id_t **id_p,
 
108
                       svn_fs_t *fs,
 
109
                       node_revision_t *noderev,
 
110
                       const svn_fs_fs__id_part_t *copy_id,
 
111
                       const svn_fs_fs__id_part_t *txn_id,
 
112
                       apr_pool_t *pool);
 
113
 
 
114
/* Remove all references to the transaction TXN_ID from filesystem FS.
 
115
   Temporary allocations are from POOL. */
 
116
svn_error_t *
 
117
svn_fs_fs__purge_txn(svn_fs_t *fs,
 
118
                     const char *txn_id,
 
119
                     apr_pool_t *pool);
 
120
 
 
121
/* Abort the existing transaction TXN, performing any temporary
 
122
   allocations in POOL. */
 
123
svn_error_t *
 
124
svn_fs_fs__abort_txn(svn_fs_txn_t *txn,
 
125
                     apr_pool_t *pool);
 
126
 
 
127
/* Add or set in filesystem FS, transaction TXN_ID, in directory
 
128
   PARENT_NODEREV a directory entry for NAME pointing to ID of type
 
129
   KIND.  Allocations are done in POOL. */
 
130
svn_error_t *
 
131
svn_fs_fs__set_entry(svn_fs_t *fs,
 
132
                     const svn_fs_fs__id_part_t *txn_id,
 
133
                     node_revision_t *parent_noderev,
 
134
                     const char *name,
 
135
                     const svn_fs_id_t *id,
 
136
                     svn_node_kind_t kind,
 
137
                     apr_pool_t *pool);
 
138
 
 
139
/* Add a change to the changes record for filesystem FS in transaction
 
140
   TXN_ID.  Mark path PATH, having node-id ID, as changed according to
 
141
   the type in CHANGE_KIND.  If the text representation was changed set
 
142
   TEXT_MOD to TRUE, and likewise for PROP_MOD as well as MERGEINFO_MOD.
 
143
   If this change was the result of a copy, set COPYFROM_REV and
 
144
   COPYFROM_PATH to the revision and path of the copy source, otherwise
 
145
   they should be set to SVN_INVALID_REVNUM and NULL.  Perform any
 
146
   temporary allocations from POOL. */
 
147
svn_error_t *
 
148
svn_fs_fs__add_change(svn_fs_t *fs,
 
149
                      const svn_fs_fs__id_part_t *txn_id,
 
150
                      const char *path,
 
151
                      const svn_fs_id_t *id,
 
152
                      svn_fs_path_change_kind_t change_kind,
 
153
                      svn_boolean_t text_mod,
 
154
                      svn_boolean_t prop_mod,
 
155
                      svn_boolean_t mergeinfo_mod,
 
156
                      svn_node_kind_t node_kind,
 
157
                      svn_revnum_t copyfrom_rev,
 
158
                      const char *copyfrom_path,
 
159
                      apr_pool_t *pool);
 
160
 
 
161
/* Return a writable stream in *STREAM that allows storing the text
 
162
   representation of node-revision NODEREV in filesystem FS.
 
163
   Allocations are from POOL. */
 
164
svn_error_t *
 
165
svn_fs_fs__set_contents(svn_stream_t **stream,
 
166
                        svn_fs_t *fs,
 
167
                        node_revision_t *noderev,
 
168
                        apr_pool_t *pool);
 
169
 
 
170
/* Create a node revision in FS which is an immediate successor of
 
171
   OLD_ID, whose contents are NEW_NR.  Set *NEW_ID_P to the new node
 
172
   revision's ID.  Use POOL for any temporary allocation.
 
173
 
 
174
   COPY_ID, if non-NULL, is a key into the `copies' table, and
 
175
   indicates that this new node is being created as the result of a
 
176
   copy operation, and specifically which operation that was.  If
 
177
   COPY_ID is NULL, then re-use the copy ID from the predecessor node.
 
178
 
 
179
   TXN_ID is the Subversion transaction under which this occurs.
 
180
 
 
181
   After this call, the deltification code assumes that the new node's
 
182
   contents will change frequently, and will avoid representing other
 
183
   nodes as deltas against this node's contents.  */
 
184
svn_error_t *
 
185
svn_fs_fs__create_successor(const svn_fs_id_t **new_id_p,
 
186
                            svn_fs_t *fs,
 
187
                            const svn_fs_id_t *old_idp,
 
188
                            node_revision_t *new_noderev,
 
189
                            const svn_fs_fs__id_part_t *copy_id,
 
190
                            const svn_fs_fs__id_part_t *txn_id,
 
191
                            apr_pool_t *pool);
 
192
 
 
193
/* Write a new property list PROPLIST for node-revision NODEREV in
 
194
   filesystem FS.  Perform any temporary allocations in POOL. */
 
195
svn_error_t *
 
196
svn_fs_fs__set_proplist(svn_fs_t *fs,
 
197
                        node_revision_t *noderev,
 
198
                        apr_hash_t *proplist,
 
199
                        apr_pool_t *pool);
 
200
 
 
201
/* Append the L2P and P2L indexes given by their proto index file names
 
202
 * L2P_PROTO_INDEX and P2L_PROTO_INDEX to the revision / pack FILE.
 
203
 * The latter contains revision(s) starting at REVISION in FS.
 
204
 * Use POOL for temporary allocations.  */
 
205
svn_error_t *
 
206
svn_fs_fs__add_index_data(svn_fs_t *fs,
 
207
                          apr_file_t *file,
 
208
                          const char *l2p_proto_index,
 
209
                          const char *p2l_proto_index,
 
210
                          svn_revnum_t revision,
 
211
                          apr_pool_t *pool);
 
212
 
 
213
/* Commit the transaction TXN in filesystem FS and return its new
 
214
   revision number in *REV.  If the transaction is out of date, return
 
215
   the error SVN_ERR_FS_TXN_OUT_OF_DATE. Use POOL for temporary
 
216
   allocations. */
 
217
svn_error_t *
 
218
svn_fs_fs__commit(svn_revnum_t *new_rev_p,
 
219
                  svn_fs_t *fs,
 
220
                  svn_fs_txn_t *txn,
 
221
                  apr_pool_t *pool);
 
222
 
 
223
/* Set *NAMES_P to an array of names which are all the active
 
224
   transactions in filesystem FS.  Allocate the array from POOL. */
 
225
svn_error_t *
 
226
svn_fs_fs__list_transactions(apr_array_header_t **names_p,
 
227
                             svn_fs_t *fs,
 
228
                             apr_pool_t *pool);
 
229
 
 
230
/* Open the transaction named NAME in filesystem FS.  Set *TXN_P to
 
231
 * the transaction. If there is no such transaction, return
 
232
` * SVN_ERR_FS_NO_SUCH_TRANSACTION.  Allocate the new transaction in
 
233
 * POOL. */
 
234
svn_error_t *
 
235
svn_fs_fs__open_txn(svn_fs_txn_t **txn_p,
 
236
                    svn_fs_t *fs,
 
237
                    const char *name,
 
238
                    apr_pool_t *pool);
 
239
 
 
240
/* Return the property list from transaction TXN and store it in
 
241
   *PROPLIST.  Allocate the property list from POOL. */
 
242
svn_error_t *
 
243
svn_fs_fs__txn_proplist(apr_hash_t **table_p,
 
244
                        svn_fs_txn_t *txn,
 
245
                        apr_pool_t *pool);
 
246
 
 
247
/* Delete the mutable node-revision referenced by ID, along with any
 
248
   mutable props or directory contents associated with it.  Perform
 
249
   temporary allocations in POOL. */
 
250
svn_error_t *
 
251
svn_fs_fs__delete_node_revision(svn_fs_t *fs,
 
252
                                const svn_fs_id_t *id,
 
253
                                apr_pool_t *pool);
 
254
 
 
255
/* Retrieve information about the Subversion transaction SVN_TXN from
 
256
   the `transactions' table of FS, allocating from POOL.  Set
 
257
   *ROOT_ID_P to the ID of the transaction's root directory.  Set
 
258
   *BASE_ROOT_ID_P to the ID of the root directory of the
 
259
   transaction's base revision.
 
260
 
 
261
   If there is no such transaction, SVN_ERR_FS_NO_SUCH_TRANSACTION is
 
262
   the error returned.
 
263
 
 
264
   Returns SVN_ERR_FS_TRANSACTION_NOT_MUTABLE if TXN_NAME refers to a
 
265
   transaction that has already been committed.
 
266
 
 
267
   Allocate *ROOT_ID_P and *BASE_ROOT_ID_P in POOL.  */
 
268
svn_error_t *
 
269
svn_fs_fs__get_txn_ids(const svn_fs_id_t **root_id_p,
 
270
                       const svn_fs_id_t **base_root_id_p,
 
271
                       svn_fs_t *fs,
 
272
                       const svn_fs_fs__id_part_t *txn_name,
 
273
                       apr_pool_t *pool);
 
274
 
 
275
/* Find the value of the property named PROPNAME in transaction TXN.
 
276
   Return the contents in *VALUE_P.  The contents will be allocated
 
277
   from POOL. */
 
278
svn_error_t *
 
279
svn_fs_fs__txn_prop(svn_string_t **value_p,
 
280
                    svn_fs_txn_t *txn,
 
281
                    const char *propname,
 
282
                    apr_pool_t *pool);
 
283
 
 
284
/* Begin a new transaction in filesystem FS, based on existing
 
285
   revision REV.  The new transaction is returned in *TXN_P.  Allocate
 
286
   the new transaction structure from POOL. */
 
287
svn_error_t *
 
288
svn_fs_fs__begin_txn(svn_fs_txn_t **txn_p,
 
289
                     svn_fs_t *fs,
 
290
                     svn_revnum_t rev,
 
291
                     apr_uint32_t flags,
 
292
                     apr_pool_t *pool);
 
293
 
 
294
#endif