1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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>
This commit is contained in:
Michael Adam 2014-03-20 23:41:03 +01:00 committed by Jeremy Allison
parent 801556fbfd
commit 9e519d97c3
2 changed files with 50 additions and 9 deletions

View File

@ -108,6 +108,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:

View File

@ -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;
}
status = idmap_autorid_init_hwm(*db, HWM);
NT_STATUS_NOT_OK_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, ALLOC_HWM_UID);
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_GID);
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);
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;