2003-06-27 03:48:46 +04:00
# ifndef _IDMAP_H_
# define _IDMAP_H_
2003-03-08 02:47:59 +03:00
/*
Unix SMB / CIFS implementation .
Idmap headers
2003-08-01 19:21:20 +04:00
Copyright ( C ) Jim McDonough < jmcd @ us . ibm . com > 2003
2003-03-08 02:47:59 +03:00
Copyright ( C ) Simo Sorce 2003
This library is free software ; you can redistribute it and / or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation ; either
version 2 of the License , or ( at your option ) any later version .
This library is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the GNU
Library General Public License for more details .
You should have received a copy of the GNU Library General Public
License along with this library ; if not , write to the
Free Software Foundation , Inc . , 59 Temple Place - Suite 330 ,
Boston , MA 02111 - 1307 , USA .
*/
2006-07-11 22:01:26 +04:00
/* idmap version determines auto-conversion - this is the database
structure version specifier . */
2006-02-04 01:19:41 +03:00
2006-07-11 22:01:26 +04:00
# define IDMAP_VERSION 2
2003-05-29 23:08:40 +04:00
2006-07-11 22:01:26 +04:00
/* The interface version specifier.
Updated to 3 for enum types by JRA . */
2003-05-29 23:08:40 +04:00
2006-12-12 17:52:13 +03:00
/* Updated to 4, completely new interface, SSS */
2003-03-08 02:47:59 +03:00
2006-12-12 17:52:13 +03:00
# define SMB_IDMAP_INTERFACE_VERSION 4
2003-03-08 20:29:40 +03:00
2006-12-12 17:52:13 +03:00
struct idmap_domain {
const char * name ;
BOOL default_domain ;
BOOL readonly ;
void * private_data ;
struct idmap_methods * methods ;
2007-04-19 01:10:37 +04:00
BOOL initialized ;
const char * params ;
2006-12-12 17:52:13 +03:00
} ;
2003-03-08 20:29:40 +03:00
2003-03-08 02:47:59 +03:00
/* Filled out by IDMAP backends */
struct idmap_methods {
/* Called when backend is first loaded */
2007-04-19 01:10:37 +04:00
NTSTATUS ( * init ) ( struct idmap_domain * dom ) ;
2006-12-12 17:52:13 +03:00
2007-04-20 02:26:09 +04:00
/* Map an array of uids/gids to SIDs. The caller specifies
the uid / gid and type . Gets back the SID . */
2006-12-12 17:52:13 +03:00
NTSTATUS ( * unixids_to_sids ) ( struct idmap_domain * dom , struct id_map * * ids ) ;
2007-04-20 02:26:09 +04:00
/* Map an arry of SIDs to uids/gids. The caller sets the SID
and type and gets back a uid or gid . */
2006-12-12 17:52:13 +03:00
NTSTATUS ( * sids_to_unixids ) ( struct idmap_domain * dom , struct id_map * * ids ) ;
2007-04-20 02:26:09 +04:00
2006-12-12 17:52:13 +03:00
NTSTATUS ( * set_mapping ) ( struct idmap_domain * dom , const struct id_map * map ) ;
NTSTATUS ( * remove_mapping ) ( struct idmap_domain * dom , const struct id_map * map ) ;
2003-03-08 02:47:59 +03:00
2006-12-12 17:52:13 +03:00
/* Called to dump backends data */
/* NOTE: caller must use talloc_free to free maps when done */
NTSTATUS ( * dump_data ) ( struct idmap_domain * dom , struct id_map * * maps , int * num_maps ) ;
2003-03-08 02:47:59 +03:00
/* Called when backend is unloaded */
2006-12-12 17:52:13 +03:00
NTSTATUS ( * close_fn ) ( struct idmap_domain * dom ) ;
} ;
struct idmap_alloc_methods {
2003-03-08 02:47:59 +03:00
2006-12-12 17:52:13 +03:00
/* Called when backend is first loaded */
NTSTATUS ( * init ) ( const char * compat_params ) ;
NTSTATUS ( * allocate_id ) ( struct unixid * id ) ;
NTSTATUS ( * get_id_hwm ) ( struct unixid * id ) ;
NTSTATUS ( * set_id_hwm ) ( struct unixid * id ) ;
/* Called when backend is unloaded */
NTSTATUS ( * close_fn ) ( void ) ;
2003-03-08 02:47:59 +03:00
} ;
2006-12-12 17:52:13 +03:00
2003-06-27 03:48:46 +04:00
# endif /* _IDMAP_H_ */