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 first version of the module API.

I want to add a paramter:
group mapping backend = tdbsam

tdbsam should be the default.

Comments please!

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_entry)(struct group_map_context *,GROUP_MAP *map, 
int flag);
         BOOL (*update_group_entry)(struct group_map_context *,GROUP_MAP 
*map, int flag);
         BOOL (*del_group_entry)(struct group_map_context *,DOM_SID sid);

         BOOL (*enum_group_entries)(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_gmap_from_sid)(struct group_map_context *,DOM_SID sid, 
GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_gmap_from_gid)(struct group_map_context *,gid_t gid, 
GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_gmap_from_ntname)(struct group_map_context *,char 
*name, GROUP_MAP *map, BOOL with_priv)

         BOOL (*get_domain_grp_from_sid)(struct group_map_context *,DOM_SID 
sid, GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_local_grp_from_sid)(struct group_map_context *,DOM_SID 
sid, GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_builtin_grp_from_sid)(struct group_map_context 
*,DOM_SID sid, 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_entry)(struct group_map_context *,GROUP_MAP *map, 
int flag);
         BOOL (*update_group_entry)(struct group_map_context *,GROUP_MAP 
*map, int flag);
         BOOL (*del_group_entry)(struct group_map_context *,DOM_SID sid);

         BOOL (*enum_group_entries)(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_gmap_from_sid)(struct group_map_context *,DOM_SID sid, 
GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_gmap_from_gid)(struct group_map_context *,gid_t gid, 
GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_gmap_from_ntname)(struct group_map_context *,char 
*name, GROUP_MAP *map, BOOL with_priv)

         BOOL (*get_domain_grp_from_sid)(struct group_map_context *,DOM_SID 
sid, GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_local_grp_from_sid)(struct group_map_context *,DOM_SID 
sid, GROUP_MAP *map, BOOL with_priv)
         BOOL (*get_builtin_grp_from_sid)(struct group_map_context 
*,DOM_SID sid, 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 <[EMAIL PROTECTED]>


Reply via email to