diff options
author | Michael Adam <obnox@samba.org> | 2014-03-20 23:41:03 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-04-03 00:26:28 +0200 |
commit | 9e519d97c36c951c47f41648529b7d5502b898a0 (patch) | |
tree | f2b088f2846f5aef0e0bebaf5060244326ea4be8 /source3 | |
parent | 801556fbfdc8ff3ea3845348bf29826e5ccbc71e (diff) | |
download | samba-9e519d97c36c951c47f41648529b7d5502b898a0.tar.gz samba-9e519d97c36c951c47f41648529b7d5502b898a0.tar.xz samba-9e519d97c36c951c47f41648529b7d5502b898a0.zip |
autorid: split idmap_autorid_db_open and idmap_autorid_init_hwms out of idmap_autorid_db_init
These will be used separately in the full initialization function.
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r-- | source3/include/idmap_autorid_tdb.h | 12 | ||||
-rw-r--r-- | source3/winbindd/idmap_autorid_tdb.c | 47 |
2 files changed, 50 insertions, 9 deletions
diff --git a/source3/include/idmap_autorid_tdb.h b/source3/include/idmap_autorid_tdb.h index acf402690c..2d2d01ade3 100644 --- a/source3/include/idmap_autorid_tdb.h +++ b/source3/include/idmap_autorid_tdb.h @@ -109,6 +109,18 @@ NTSTATUS idmap_autorid_delete_range_by_num(struct db_context *db, NTSTATUS idmap_autorid_init_hwm(struct db_context *db, const char *hwm); /** + * Open and possibly create the autorid database. + */ +NTSTATUS idmap_autorid_db_open(const char *path, + TALLOC_CTX *mem_ctx, + struct db_context **db); + +/** + * Initialize the high watermark records in the database. + */ +NTSTATUS idmap_autorid_init_hwms(struct db_context *db); + +/** * Initialize an idmap_autorid database. * After this function has successfully completed, the following are true: * - the database exists diff --git a/source3/winbindd/idmap_autorid_tdb.c b/source3/winbindd/idmap_autorid_tdb.c index cbd9080146..21e15089e9 100644 --- a/source3/winbindd/idmap_autorid_tdb.c +++ b/source3/winbindd/idmap_autorid_tdb.c @@ -699,10 +699,10 @@ NTSTATUS idmap_autorid_delete_range_by_num(struct db_context *db, return status; } -/* - * open and initialize the database which stores the ranges for the domains +/** + * Open and possibly create the database. */ -NTSTATUS idmap_autorid_db_init(const char *path, +NTSTATUS idmap_autorid_db_open(const char *path, TALLOC_CTX *mem_ctx, struct db_context **db) { @@ -722,19 +722,48 @@ NTSTATUS idmap_autorid_db_init(const char *path, return NT_STATUS_UNSUCCESSFUL; } - /* Initialize high water mark for the currently used range to 0 */ + return status; +} + +/** + * Initialize the high watermark records in the database. + */ +NTSTATUS idmap_autorid_init_hwms(struct db_context *db) +{ + NTSTATUS status; - status = idmap_autorid_init_hwm(*db, HWM); - NT_STATUS_NOT_OK_RETURN(status); + status = idmap_autorid_init_hwm(db, HWM); + if (!NT_STATUS_IS_OK(status)) { + return status; + } - status = idmap_autorid_init_hwm(*db, ALLOC_HWM_UID); - NT_STATUS_NOT_OK_RETURN(status); + status = idmap_autorid_init_hwm(db, ALLOC_HWM_UID); + if (!NT_STATUS_IS_OK(status)) { + return status; + } - status = idmap_autorid_init_hwm(*db, ALLOC_HWM_GID); + status = idmap_autorid_init_hwm(db, ALLOC_HWM_GID); return status; } +NTSTATUS idmap_autorid_db_init(const char *path, + TALLOC_CTX *mem_ctx, + struct db_context **db) +{ + NTSTATUS status; + + status = idmap_autorid_db_open(path, mem_ctx, db); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + status = idmap_autorid_init_hwms(*db); + return status; +} + + + struct idmap_autorid_fetch_config_state { TALLOC_CTX *mem_ctx; char *configstr; |