| 1 | #ifndef _IDMAP_H_
|
|---|
| 2 | #define _IDMAP_H_
|
|---|
| 3 | /*
|
|---|
| 4 | Unix SMB/CIFS implementation.
|
|---|
| 5 |
|
|---|
| 6 | Idmap headers
|
|---|
| 7 |
|
|---|
| 8 | Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
|
|---|
| 9 | Copyright (C) Simo Sorce 2003
|
|---|
| 10 |
|
|---|
| 11 | This library is free software; you can redistribute it and/or
|
|---|
| 12 | modify it under the terms of the GNU Library General Public
|
|---|
| 13 | License as published by the Free Software Foundation; either
|
|---|
| 14 | version 2 of the License, or (at your option) any later version.
|
|---|
| 15 |
|
|---|
| 16 | This library is distributed in the hope that it will be useful,
|
|---|
| 17 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 19 | Library General Public License for more details.
|
|---|
| 20 |
|
|---|
| 21 | You should have received a copy of the GNU Library General Public
|
|---|
| 22 | License along with this library; if not, write to the
|
|---|
| 23 | Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|---|
| 24 | Boston, MA 02111-1307, USA.
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 | /* idmap version determines auto-conversion - this is the database
|
|---|
| 28 | structure version specifier. */
|
|---|
| 29 |
|
|---|
| 30 | #define IDMAP_VERSION 2
|
|---|
| 31 |
|
|---|
| 32 | /* The interface version specifier.
|
|---|
| 33 | Updated to 3 for enum types by JRA. */
|
|---|
| 34 |
|
|---|
| 35 | /* Updated to 4, completely new interface, SSS */
|
|---|
| 36 |
|
|---|
| 37 | #define SMB_IDMAP_INTERFACE_VERSION 4
|
|---|
| 38 |
|
|---|
| 39 | struct idmap_domain {
|
|---|
| 40 | const char *name;
|
|---|
| 41 | BOOL default_domain;
|
|---|
| 42 | BOOL readonly;
|
|---|
| 43 | void *private_data;
|
|---|
| 44 | struct idmap_methods *methods;
|
|---|
| 45 | BOOL initialized;
|
|---|
| 46 | const char *params;
|
|---|
| 47 | };
|
|---|
| 48 |
|
|---|
| 49 | /* Filled out by IDMAP backends */
|
|---|
| 50 | struct idmap_methods {
|
|---|
| 51 |
|
|---|
| 52 | /* Called when backend is first loaded */
|
|---|
| 53 | NTSTATUS (*init)(struct idmap_domain *dom);
|
|---|
| 54 |
|
|---|
| 55 | /* Map an array of uids/gids to SIDs. The caller specifies
|
|---|
| 56 | the uid/gid and type. Gets back the SID. */
|
|---|
| 57 | NTSTATUS (*unixids_to_sids)(struct idmap_domain *dom, struct id_map **ids);
|
|---|
| 58 |
|
|---|
| 59 | /* Map an arry of SIDs to uids/gids. The caller sets the SID
|
|---|
| 60 | and type and gets back a uid or gid. */
|
|---|
| 61 | NTSTATUS (*sids_to_unixids)(struct idmap_domain *dom, struct id_map **ids);
|
|---|
| 62 |
|
|---|
| 63 | NTSTATUS (*set_mapping)(struct idmap_domain *dom, const struct id_map *map);
|
|---|
| 64 | NTSTATUS (*remove_mapping)(struct idmap_domain *dom, const struct id_map *map);
|
|---|
| 65 |
|
|---|
| 66 | /* Called to dump backends data */
|
|---|
| 67 | /* NOTE: caller must use talloc_free to free maps when done */
|
|---|
| 68 | NTSTATUS (*dump_data)(struct idmap_domain *dom, struct id_map **maps, int *num_maps);
|
|---|
| 69 |
|
|---|
| 70 | /* Called when backend is unloaded */
|
|---|
| 71 | NTSTATUS (*close_fn)(struct idmap_domain *dom);
|
|---|
| 72 | };
|
|---|
| 73 |
|
|---|
| 74 | struct idmap_alloc_methods {
|
|---|
| 75 |
|
|---|
| 76 | /* Called when backend is first loaded */
|
|---|
| 77 | NTSTATUS (*init)(const char *compat_params);
|
|---|
| 78 |
|
|---|
| 79 | NTSTATUS (*allocate_id)(struct unixid *id);
|
|---|
| 80 | NTSTATUS (*get_id_hwm)(struct unixid *id);
|
|---|
| 81 | NTSTATUS (*set_id_hwm)(struct unixid *id);
|
|---|
| 82 |
|
|---|
| 83 | /* Called when backend is unloaded */
|
|---|
| 84 | NTSTATUS (*close_fn)(void);
|
|---|
| 85 | };
|
|---|
| 86 |
|
|---|
| 87 | #endif /* _IDMAP_H_ */
|
|---|