idmap api

Stefan (metze) Metzmacher metze at metzemix.de
Tue Oct 22 17:14:01 GMT 2002


Hi,

here's a proposal for the idmap api;

we'll have a cache that will be asked first, if this fails we ask the 
central idmap and add the result to our cache.

the idmap_central_* functions should be plugable/selectable (different 
backends should be allowed here)

and the backend should decide how to handle unmapped id's.

comments please

/* idmap api */
NT_STATUS idmap_sid_to_id(DOM_SID *sid, int *id, BOOL *group);
{
         if (NT_STATUS_IS_OK(idmap_cache_sid_to_id(sid,id,group)))
         {
                 return NT_STATUS_OK;
         }

         if (!NT_STATUS_IS_OK(idmap_central_sid_to_id(sid,id,group)))
         {
                 return NT_STATUS_UNSUCCESFUL;
         }

         idmap_cache_update(sid,id,group);
         return NT_STATUS_OK;
}

NT_STATUS idmap_uid_to_sid(uid_t uid, DOM_SID **sid);
{
         if (NT_STATUS_IS_OK(idmap_cache_uid_to_sid(uid,sid)))
         {
                 return NT_STATUS_OK;
         }

         if (!NT_STATUS_IS_OK(idmap_central_uid_to_sid(uid,sid)))
         {
                 return NT_STATUS_UNSUCCESFUL;
         }

         idmap_cache_update(sid,uid,False);
         return NT_STATUS_OK;
}

NT_STATUS idmap_gid_to_sid(gid_t gid, DOM_SID **sid);
{
         if (NT_STATUS_IS_OK(idmap_cache_gid_to_sid(gid,sid)))
         {
                 return NT_STATUS_OK;
         }

         if (!NT_STATUS_IS_OK(idmap_central_gid_to_sid(gid,sid)))
         {
                 return NT_STATUS_UNSUCCESFUL;
         }

         idmap_cache_update(sid,gid,True);
         return NT_STATUS_OK;
}


metze
-----------------------------------------------------------------------------
Stefan "metze" Metzmacher <metze at metzemix.de>




More information about the samba-technical mailing list