summaryrefslogtreecommitdiff
path: root/source3/winbindd
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2010-06-17 08:11:19 +0200
committerMichael Adam <obnox@samba.org>2010-08-14 02:10:50 +0200
commit10395064933bd1c92d647606b4b3958aaacaf759 (patch)
tree93443df47b298a31922a86dca19fe728587aff57 /source3/winbindd
parentf739ccb1b9da4b5b7941944e8a4342049254c8d8 (diff)
downloadsamba-10395064933bd1c92d647606b4b3958aaacaf759.tar.gz
samba-10395064933bd1c92d647606b4b3958aaacaf759.tar.bz2
samba-10395064933bd1c92d647606b4b3958aaacaf759.zip
s3:idmap_tdb: move idmap_tdb_init_hwm up.
Diffstat (limited to 'source3/winbindd')
-rw-r--r--source3/winbindd/idmap_tdb.c120
1 files changed, 58 insertions, 62 deletions
diff --git a/source3/winbindd/idmap_tdb.c b/source3/winbindd/idmap_tdb.c
index 0cee04d182..fc7ee1ab09 100644
--- a/source3/winbindd/idmap_tdb.c
+++ b/source3/winbindd/idmap_tdb.c
@@ -206,6 +206,64 @@ static bool idmap_tdb_upgrade(struct idmap_domain *dom, struct db_context *db)
return True;
}
+static NTSTATUS idmap_tdb_init_hwm(struct idmap_domain *dom)
+{
+ int ret;
+ uint32_t low_uid;
+ uint32_t low_gid;
+ bool update_uid = false;
+ bool update_gid = false;
+ struct idmap_tdb_context *ctx;
+
+ ctx = talloc_get_type(dom->private_data, struct idmap_tdb_context);
+
+ low_uid = dbwrap_fetch_int32(ctx->db, HWM_USER);
+ if (low_uid == -1 || low_uid < dom->low_id) {
+ update_uid = true;
+ }
+
+ low_gid = dbwrap_fetch_int32(ctx->db, HWM_GROUP);
+ if (low_gid == -1 || low_gid < dom->low_id) {
+ update_gid = true;
+ }
+
+ if (!update_uid && !update_gid) {
+ return NT_STATUS_OK;
+ }
+
+ if (ctx->db->transaction_start(ctx->db) != 0) {
+ DEBUG(0, ("Unable to start upgrade transaction!\n"));
+ return NT_STATUS_INTERNAL_DB_ERROR;
+ }
+
+ if (update_uid) {
+ ret = dbwrap_store_int32(ctx->db, HWM_USER, dom->low_id);
+ if (ret == -1) {
+ ctx->db->transaction_cancel(ctx->db);
+ DEBUG(0, ("Unable to initialise user hwm in idmap "
+ "database\n"));
+ return NT_STATUS_INTERNAL_DB_ERROR;
+ }
+ }
+
+ if (update_gid) {
+ ret = dbwrap_store_int32(ctx->db, HWM_GROUP, dom->low_id);
+ if (ret == -1) {
+ ctx->db->transaction_cancel(ctx->db);
+ DEBUG(0, ("Unable to initialise group hwm in idmap "
+ "database\n"));
+ return NT_STATUS_INTERNAL_DB_ERROR;
+ }
+ }
+
+ if (ctx->db->transaction_commit(ctx->db) != 0) {
+ DEBUG(0, ("Unable to commit upgrade transaction!\n"));
+ return NT_STATUS_INTERNAL_DB_ERROR;
+ }
+
+ return NT_STATUS_OK;
+}
+
static NTSTATUS idmap_tdb_open_db(struct idmap_domain *dom)
{
NTSTATUS ret;
@@ -284,68 +342,6 @@ done:
static struct db_context *idmap_alloc_db;
/**********************************
- Initialise idmap alloc database.
-**********************************/
-
-static NTSTATUS idmap_tdb_init_hwm(struct idmap_domain *dom)
-{
- int ret;
- uint32_t low_uid;
- uint32_t low_gid;
- bool update_uid = false;
- bool update_gid = false;
- struct idmap_tdb_context *ctx;
-
- ctx = talloc_get_type(dom->private_data, struct idmap_tdb_context);
-
- low_uid = dbwrap_fetch_int32(ctx->db, HWM_USER);
- if (low_uid == -1 || low_uid < dom->low_id) {
- update_uid = true;
- }
-
- low_gid = dbwrap_fetch_int32(ctx->db, HWM_GROUP);
- if (low_gid == -1 || low_gid < dom->low_id) {
- update_gid = true;
- }
-
- if (!update_uid && !update_gid) {
- return NT_STATUS_OK;
- }
-
- if (ctx->db->transaction_start(ctx->db) != 0) {
- DEBUG(0, ("Unable to start upgrade transaction!\n"));
- return NT_STATUS_INTERNAL_DB_ERROR;
- }
-
- if (update_uid) {
- ret = dbwrap_store_int32(ctx->db, HWM_USER, dom->low_id);
- if (ret == -1) {
- ctx->db->transaction_cancel(ctx->db);
- DEBUG(0, ("Unable to initialise user hwm in idmap "
- "database\n"));
- return NT_STATUS_INTERNAL_DB_ERROR;
- }
- }
-
- if (update_gid) {
- ret = dbwrap_store_int32(ctx->db, HWM_GROUP, dom->low_id);
- if (ret == -1) {
- ctx->db->transaction_cancel(ctx->db);
- DEBUG(0, ("Unable to initialise group hwm in idmap "
- "database\n"));
- return NT_STATUS_INTERNAL_DB_ERROR;
- }
- }
-
- if (ctx->db->transaction_commit(ctx->db) != 0) {
- DEBUG(0, ("Unable to commit upgrade transaction!\n"));
- return NT_STATUS_INTERNAL_DB_ERROR;
- }
-
- return NT_STATUS_OK;
-}
-
-/**********************************
Allocate a new id.
**********************************/