00001 #ifndef _IDMAP_H_ 00002 #define _IDMAP_H_ 00003 /* 00004 Unix SMB/CIFS implementation. 00005 00006 Idmap headers 00007 00008 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003 00009 Copyright (C) Simo Sorce 2003 00010 00011 This library is free software; you can redistribute it and/or 00012 modify it under the terms of the GNU Library General Public 00013 License as published by the Free Software Foundation; either 00014 version 2 of the License, or (at your option) any later version. 00015 00016 This library is distributed in the hope that it will be useful, 00017 but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00019 Library General Public License for more details. 00020 00021 You should have received a copy of the GNU Library General Public 00022 License along with this library; if not, write to the 00023 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00024 Boston, MA 02111-1307, USA. 00025 */ 00026 00027 /* idmap version determines auto-conversion - this is the database 00028 structure version specifier. */ 00029 00030 #define IDMAP_VERSION 2 00031 00032 /* The interface version specifier. 00033 Updated to 3 for enum types by JRA. */ 00034 00035 /* Updated to 4, completely new interface, SSS */ 00036 00037 #define SMB_IDMAP_INTERFACE_VERSION 4 00038 00039 struct idmap_domain { 00040 const char *name; 00041 BOOL default_domain; 00042 BOOL readonly; 00043 void *private_data; 00044 struct idmap_methods *methods; 00045 BOOL initialized; 00046 const char *params; 00047 }; 00048 00049 /* Filled out by IDMAP backends */ 00050 struct idmap_methods { 00051 00052 /* Called when backend is first loaded */ 00053 NTSTATUS (*init)(struct idmap_domain *dom); 00054 00055 /* Map an array of uids/gids to SIDs. The caller specifies 00056 the uid/gid and type. Gets back the SID. */ 00057 NTSTATUS (*unixids_to_sids)(struct idmap_domain *dom, struct id_map **ids); 00058 00059 /* Map an arry of SIDs to uids/gids. The caller sets the SID 00060 and type and gets back a uid or gid. */ 00061 NTSTATUS (*sids_to_unixids)(struct idmap_domain *dom, struct id_map **ids); 00062 00063 NTSTATUS (*set_mapping)(struct idmap_domain *dom, const struct id_map *map); 00064 NTSTATUS (*remove_mapping)(struct idmap_domain *dom, const struct id_map *map); 00065 00066 /* Called to dump backends data */ 00067 /* NOTE: caller must use talloc_free to free maps when done */ 00068 NTSTATUS (*dump_data)(struct idmap_domain *dom, struct id_map **maps, int *num_maps); 00069 00070 /* Called when backend is unloaded */ 00071 NTSTATUS (*close_fn)(struct idmap_domain *dom); 00072 }; 00073 00074 struct idmap_alloc_methods { 00075 00076 /* Called when backend is first loaded */ 00077 NTSTATUS (*init)(const char *compat_params); 00078 00079 NTSTATUS (*allocate_id)(struct unixid *id); 00080 NTSTATUS (*get_id_hwm)(struct unixid *id); 00081 NTSTATUS (*set_id_hwm)(struct unixid *id); 00082 00083 /* Called when backend is unloaded */ 00084 NTSTATUS (*close_fn)(void); 00085 }; 00086 00087 #endif /* _IDMAP_H_ */