Modulize Group mapping

Stefan (metze) Metzmacher metze at metzemix.de
Wed Jun 12 02:04:03 GMT 2002


Hi,

I've startet to make the group mapping code modulized in the way it is done 
in the auth and passdb subsystems.

Here is my 2. version of the module API.

I remove the 'Higheer Level functions
  get_domain_group_from_sid
  get_local_group_from_sid
  get_builtin_group_from_sid

they all call get_group_map_from_sid.

metze

-------------------------------------------------------------------------------------------------
/*****************************************************************
  Functions to be implemented by the (new) group mapping API
****************************************************************/

typedef struct group_map_context
{
         struct group_map_methods *group_map_methods;
         struct group_map_methods *grpent_methods;

         /* These functions are wrappers for the functions listed above.
            They may do extra things like re-reading a GROUP_MAP on update */

         BOOL (*add_group_mapping)(struct group_map_context *,GROUP_MAP 
*map, int flag);
         BOOL (*update_group_mapping)(struct group_map_context *,GROUP_MAP 
*map, int flag);
         BOOL (*delete_group_mapping)(struct group_map_context *,DOM_SID sid);

         BOOL (*enum_group_mappings)(struct group_map_context *,enum 
SID_NAME_USE sid_name_use, GROUP_MAP **rmap,
                         int *num_entries, BOOL unix_only, BOOL with_priv);

         BOOL (*get_group_map_from_sid)(struct group_map_context *,DOM_SID 
sid, GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_group_map_from_gid)(struct group_map_context *,gid_t 
gid, GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_group_map_from_ntname)(struct group_map_context *,char 
*name, GROUP_MAP *map, BOOL with_priv)

         BOOL (*get_group_from_gid)(struct group_map_context *,gid_t gid, 
GROUP_MAP *map, BOOL with_priv)

         BOOL (*get_uid_list_of_group)(struct group_map_context *,gid_t 
gid, uid_t **uid, int *num_uids)


         void (*free_fn)(struct group_map_context **);

         TALLOC_CTX *mem_ctx;

} GROUP_MAP_CONTEXT;

typedef struct group_map_methods
{
         const char *name; /* What name got this module */
         struct group_map_context *parent;

         /* Use macros from dlinklist.h on these two */
         struct group_map_methods *next;
         struct group_map_methods *prev;

         BOOL (*add_group_mapping)(struct group_map_context *,GROUP_MAP 
*map, int flag);
         BOOL (*update_group_mapping)(struct group_map_context *,GROUP_MAP 
*map, int flag);
         BOOL (*del_group_mapping)(struct group_map_context *,DOM_SID sid);

         BOOL (*enum_group_mapping)(struct group_map_context *,enum 
SID_NAME_USE sid_name_use, GROUP_MAP **rmap,
                         int *num_entries, BOOL unix_only, BOOL with_priv);

         BOOL (*get_group_map_from_sid)(struct group_map_context *,DOM_SID 
sid, GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_group_map_from_gid)(struct group_map_context *,gid_t 
gid, GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_group_map_from_ntname)(struct group_map_context *,char 
*name, GROUP_MAP *map, BOOL with_priv)

         BOOL (*get_group_from_gid)(struct group_map_context *,gid_t gid, 
GROUP_MAP *map, BOOL with_priv)

         BOOL (*get_uid_list_of_group)(struct group_map_context *,gid_t 
gid, uid_t **uid, int *num_uids)

         void *private_data;  /* Private data of some kind */

         void (*free_private_data)(void **);

} GROUP_MAP_METHODS;

typedef NTSTATUS (*group_map_init_function)(struct group_map_context *,
                         struct group_map_methods **,
                         const char *);

struct group_map_init_function_entry {
         char *name;
         /* Function to create a member of the group_map_methods list */
         group_map_init_function init;
};
-------------------------------------------------


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





More information about the samba-technical mailing list