s4:dsdb Be strict in selecting on-disk names for partitions
[ira/wip.git] / source4 / dsdb / samdb / ldb_modules / partition.h
1 /* 
2    Partitions ldb module
3
4    Copyright (C) Andrew Bartlett <abartlet@samba.org> 2006
5    Copyright (C) Stefan Metzmacher <metze@samba.org> 2007
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 3 of the License, or
10    (at your option) any later version.
11    
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16    
17    You should have received a copy of the GNU General Public License
18    along with this program.  If not, see <http://www.gnu.org/licenses/>.
19 */
20 #include "includes.h"
21 #include "lib/ldb/include/ldb.h"
22 #include "lib/ldb/include/ldb_errors.h"
23 #include "lib/ldb/include/ldb_module.h"
24 #include "lib/ldb/include/ldb_private.h"
25 #include "dsdb/samdb/samdb.h"
26 #include "dsdb/samdb/ldb_modules/util.h"
27 #include "system/locale.h"
28
29 struct dsdb_partition {
30         struct ldb_module *module;
31         struct dsdb_control_current_partition *ctrl;
32 };
33
34 struct partition_module {
35         const char **modules;
36         struct ldb_dn *dn;
37 };
38
39 struct partition_private_data {
40         struct dsdb_partition **partitions;
41         struct ldb_dn **replicate;
42         
43         struct partition_module **modules;
44         const char *ldapBackend;
45 };
46
47 #define PARTITION_FIND_OP_NOERROR(module, op) do { \
48         while (module && module->ops->op == NULL) module = module->next; \
49 } while (0)
50
51 #define PARTITION_FIND_OP(module, op) do { \
52         PARTITION_FIND_OP_NOERROR(module, op); \
53         if (module == NULL) { \
54                 ldb_asprintf_errstring(ldb_module_get_ctx(module), \
55                         "Unable to find backend operation for " #op ); \
56                 return LDB_ERR_OPERATIONS_ERROR; \
57         } \
58 } while (0)
59
60 #include "dsdb/samdb/ldb_modules/partition_proto.h"