From 28cef867c761ac87101e3049628cfe2a073e65f2 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Wed, 30 Apr 2003 16:35:17 +0000 Subject: correctly initiazlize idmap tdb when creationg new few fixes to *id_to_*id functions, we don't set the mapping for algoritmic RIDs, they are resolved in the classic way eliminate getpw* calls from tdbsam (This used to be commit 6a7689cf74cd4d5f29e0b12f4bf8ac3051d49157) --- source3/passdb/passdb.c | 53 ------------------------------------------------ source3/passdb/pdb_tdb.c | 2 +- 2 files changed, 1 insertion(+), 54 deletions(-) (limited to 'source3/passdb') diff --git a/source3/passdb/passdb.c b/source3/passdb/passdb.c index c93577dc04..b13ecf7a33 100644 --- a/source3/passdb/passdb.c +++ b/source3/passdb/passdb.c @@ -428,59 +428,6 @@ NTSTATUS pdb_set_sam_sids(SAM_ACCOUNT *account_data, const struct passwd *pwd) return NT_STATUS_OK; } -/****************************************************************** - * Get the free RID base if idmap is configured, otherwise return 0 - ******************************************************************/ - -uint32 pdb_get_free_rid_base(void) -{ - uint32 low, high; - if (pdb_get_free_rid_range(&low, &high)) { - return low; - } - return 0; -} - -/****************************************************************** - * Get the the non-algorithmic RID range if idmap range are defined - ******************************************************************/ - -BOOL pdb_get_free_rid_range(uint32 *low, uint32 *high) -{ - uid_t u_low, u_high; - gid_t g_low, g_high; - uint32 id_low, id_high; - - if (lp_idmap_only()) { - *low = BASE_RID; - *high = -1; - } - - if (lp_idmap_uid(&u_low, &u_high) && lp_idmap_gid(&g_low, &g_high)) { - if (u_low < g_low) { - id_low = u_low; - } else { - id_low = g_low; - } - if (u_high > g_high) { - id_high = u_high; - } else { - id_high = g_high; - } - - *low = fallback_pdb_uid_to_user_rid(id_low); - if (fallback_pdb_user_rid_to_uid(-1) < id_high) { - *high = -1; - } else { - *high = fallback_pdb_uid_to_user_rid(id_high); - } - - return True; - } - - return False; -} - /********************************************************** Encode the account control bits into a string. length = length of string to encode into (including terminating diff --git a/source3/passdb/pdb_tdb.c b/source3/passdb/pdb_tdb.c index 2715c3e3ca..3ed5d2d4d6 100644 --- a/source3/passdb/pdb_tdb.c +++ b/source3/passdb/pdb_tdb.c @@ -754,7 +754,7 @@ static BOOL tdb_update_sam(struct pdb_methods *my_methods, SAM_ACCOUNT* newpwd, if (!(user_rid = pdb_get_user_rid(newpwd))) { if ((flag & TDB_INSERT) && tdb_state->permit_non_unix_accounts) { uint32 lowrid, highrid; - if (!pdb_get_free_rid_range(&lowrid, &highrid)) { + if (!idmap_get_free_rid_range(&lowrid, &highrid)) { /* should never happen */ DEBUG(0, ("tdbsam: something messed up, no high/low rids but nua enabled ?!\n")); ret = False; -- cgit