idmap_autorid: change idmap_autorid_loadconfig() to return NTSTATUS
[Samba.git] / source3 / include / idmap_autorid_tdb.h
blobe385f493b62a22cae0e2138871d15c3991c372ee
1 /*
2 * idmap_autorid: static map between Active Directory/NT RIDs
3 * and RFC 2307 accounts. This file contains common functions
4 * and structures used by idmap_autorid and net idmap autorid utilities
6 * Copyright (C) Christian Ambach, 2010-2012
7 * Copyright (C) Atul Kulkarni, 2013
8 * Copyright (C) Michael Adam, 2012-2013
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 3 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, see <http://www.gnu.org/licenses/>.
25 #ifndef _IDMAP_AUTORID_H_
26 #define _IDMAP_AUTORID_H_
28 #include "includes.h"
29 #include "system/filesys.h"
30 #include "dbwrap/dbwrap.h"
31 #include "dbwrap/dbwrap_open.h"
32 #include "../lib/util/util_tdb.h"
33 #include "winbindd/idmap_tdb_common.h"
35 #define HWM "NEXT RANGE"
36 #define ALLOC_HWM_UID "NEXT ALLOC UID"
37 #define ALLOC_HWM_GID "NEXT ALLOC GID"
38 #define ALLOC_RANGE "ALLOC"
39 #define CONFIGKEY "CONFIG"
41 struct autorid_global_config {
42 uint32_t minvalue;
43 uint32_t rangesize;
44 uint32_t maxranges;
47 struct autorid_range_config {
48 fstring domsid;
49 fstring keystr;
50 uint32_t rangenum;
51 uint32_t domain_range_index;
52 uint32_t low_id;
53 struct autorid_global_config *globalcfg;
56 NTSTATUS idmap_autorid_get_domainrange(struct db_context *db,
57 struct autorid_range_config *range,
58 bool read_only);
60 NTSTATUS idmap_autorid_init_hwm(struct db_context *db, const char *hwm);
62 NTSTATUS idmap_autorid_db_init(const char *path,
63 TALLOC_CTX *mem_ctx,
64 struct db_context **db);
66 NTSTATUS idmap_autorid_loadconfig(struct db_context *db,
67 TALLOC_CTX *ctx,
68 struct autorid_global_config **result);
70 NTSTATUS idmap_autorid_saveconfig(struct db_context *db,
71 struct autorid_global_config *cfg);
73 /**
74 * get the range config string stored in the database
76 NTSTATUS idmap_autorid_getconfigstr(struct db_context *db, TALLOC_CTX *mem_ctx,
77 char **result);
79 /**
80 * parse the handed in config string and fill the provided config structure.
81 * return false if the string could not be parsed.
83 bool idmap_autorid_parse_configstr(const char *configstr,
84 struct autorid_global_config *cfg);
86 #endif /* _IDMAP_AUTORID_H_ */