Author: vlendec
Date: 2005-12-27 22:42:23 +0000 (Tue, 27 Dec 2005)
New Revision: 12527

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=12527

Log:
Remove get_free_rid_range. This was called only from within tdb and ldapsam,
both of which defined pdb_rid_algorithm to true. In that case BASE_RID was
chosen.

Volker

Modified:
   trunk/source/lib/smbldap_util.c
   trunk/source/passdb/passdb.c
   trunk/source/sam/idmap_tdb.c


Changeset:
Modified: trunk/source/lib/smbldap_util.c
===================================================================
--- trunk/source/lib/smbldap_util.c     2005-12-27 22:32:49 UTC (rev 12526)
+++ trunk/source/lib/smbldap_util.c     2005-12-27 22:42:23 UTC (rev 12527)
@@ -103,9 +103,6 @@
        LDAPMessage *result = NULL;
        int num_result;
        const char **attr_list;
-       uid_t u_low, u_high;
-       gid_t g_low, g_high;
-       uint32 rid_low, rid_high;
 
        slprintf (filter, sizeof (filter) - 1, "(&(%s=%s)(objectclass=%s))", 
                  get_attr_key2string(dominfo_attr_list, LDAP_ATTR_DOMAIN), 
@@ -152,27 +149,17 @@
                        algorithmic_rid_base_string);
        smbldap_set_mod(&mods, LDAP_MOD_ADD, "objectclass", LDAP_OBJ_DOMINFO);
        
-       /* add the sambaNext[User|Group]Rid attributes if the idmap ranges are 
set.
-          TODO: fix all the places where the line between idmap and normal 
operations
-          needed by smbd gets fuzzy   --jerry 2003-08-11                       
       */
+       /* add the sambaNextUserRid attributes. */
        
-       if ( lp_idmap_uid(&u_low, &u_high) && lp_idmap_gid(&g_low, &g_high)
-               && get_free_rid_range(&rid_low, &rid_high) ) 
        {
+               uint32 rid = BASE_RID;
                fstring rid_str;
                
-               fstr_sprintf( rid_str, "%i", rid_low|USER_RID_TYPE );
+               fstr_sprintf( rid_str, "%i", rid );
                DEBUG(10,("setting next available user rid [%s]\n", rid_str));
                smbldap_set_mod(&mods, LDAP_MOD_ADD, 
                        get_attr_key2string(dominfo_attr_list, 
LDAP_ATTR_NEXT_USERRID), 
                        rid_str);
-                       
-               fstr_sprintf( rid_str, "%i", rid_low|GROUP_RID_TYPE );
-               DEBUG(10,("setting next available group rid [%s]\n", rid_str));
-               smbldap_set_mod(&mods, LDAP_MOD_ADD, 
-                       get_attr_key2string(dominfo_attr_list, 
LDAP_ATTR_NEXT_GROUPRID), 
-                       rid_str);
-               
         }
 
 

Modified: trunk/source/passdb/passdb.c
===================================================================
--- trunk/source/passdb/passdb.c        2005-12-27 22:32:49 UTC (rev 12526)
+++ trunk/source/passdb/passdb.c        2005-12-27 22:42:23 UTC (rev 12527)
@@ -1926,52 +1926,6 @@
        return result;
 }
 
-/**********************************************************************
-**********************************************************************/
-
-static BOOL get_free_ugid_range(uint32 *low, uint32 *high)
-{
-       uid_t u_low, u_high;
-       gid_t g_low, g_high;
-
-       if (!lp_idmap_uid(&u_low, &u_high) || !lp_idmap_gid(&g_low, &g_high)) {
-               return False;
-       }
-       
-       *low  = (u_low < g_low)   ? u_low  : g_low;
-       *high = (u_high < g_high) ? u_high : g_high;
-       
-       return True;
-}
-
-/******************************************************************
- Get the the non-algorithmic RID range if idmap range are defined
-******************************************************************/
-
-BOOL get_free_rid_range(uint32 *low, uint32 *high)
-{
-       uint32 id_low, id_high;
-
-       if (!pdb_rid_algorithm()) {
-               *low = BASE_RID;
-               *high = (uint32)-1;
-               return True;
-       }
-
-       if (!get_free_ugid_range(&id_low, &id_high)) {
-               return False;
-       }
-
-       *low = algorithmic_pdb_uid_to_user_rid(id_low);
-       if (algorithmic_pdb_user_rid_to_uid((uint32)-1) < id_high) {
-               *high = (uint32)-1;
-       } else {
-               *high = algorithmic_pdb_uid_to_user_rid(id_high);
-       }
-
-       return True;
-}
-
 /*********************************************************************
  Update the bad password count checking the AP_RESET_COUNT_TIME 
 *********************************************************************/

Modified: trunk/source/sam/idmap_tdb.c
===================================================================
--- trunk/source/sam/idmap_tdb.c        2005-12-27 22:32:49 UTC (rev 12526)
+++ trunk/source/sam/idmap_tdb.c        2005-12-27 22:42:23 UTC (rev 12527)
@@ -51,21 +51,19 @@
 
 static NTSTATUS db_allocate_rid(uint32 *rid)
 {
-       uint32 lowrid, highrid;
        uint32 tmp_rid;
-
-       /* cannot fail since idmap is only called winbindd */
        
-       get_free_rid_range( &lowrid, &highrid );
+       tmp_rid = BASE_RID;     /* Default if RID_COUNTER is not set */
        
-       tmp_rid = lowrid;
-       
-       if ( !tdb_change_uint32_atomic(idmap_tdb, "RID_COUNTER", &tmp_rid, 
RID_MULTIPLIER) ) {
-               DEBUG(3,("db_allocate_rid: Failed to locate next rid record in 
idmap db\n"));
+       if ( !tdb_change_uint32_atomic(idmap_tdb, "RID_COUNTER",
+                                      &tmp_rid, 1) ) {
+               DEBUG(3,("db_allocate_rid: Failed to locate next rid record "
+                        "in idmap db\n"));
                return NT_STATUS_UNSUCCESSFUL;
        }
        
-       if ( tmp_rid > highrid ) {
+       if ( tmp_rid > 0xfffffff0 ) {
+               /* Not sure this limit is right... */
                DEBUG(0, ("db_allocate_rid: no RIDs available!\n"));
                return NT_STATUS_UNSUCCESSFUL;
        }

Reply via email to