+#ifndef _IDMAP_H_
+#define _IDMAP_H_
/*
Unix SMB/CIFS implementation.
Idmap headers
- Copyright (C) Anthony Liguori 2003
+ Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
Copyright (C) Simo Sorce 2003
This library is free software; you can redistribute it and/or
Boston, MA 02111-1307, USA.
*/
-#define ID_EMPTY 0x00
-#define ID_USERID 0x01
-#define ID_GROUPID 0x02
-#define ID_OTHER 0x04
+/* idmap version determines auto-conversion - this is the database
+ structure version specifier. */
-#define ID_TYPEMASK 0x0f
+#define IDMAP_VERSION 2
-#define ID_NOMAP 0x10
-#define ID_CACHE 0x20
+/* The interface version specifier.
+ Updated to 3 for enum types by JRA. */
-typedef union unid_t {
- uid_t uid;
- gid_t gid;
-} unid_t;
+/* Updated to 4, completely new interface, SSS */
+
+#define SMB_IDMAP_INTERFACE_VERSION 4
+
+struct idmap_domain {
+ const char *name;
+ BOOL default_domain;
+ BOOL readonly;
+ void *private_data;
+ struct idmap_methods *methods;
+ BOOL initialized;
+ const char *params;
+};
/* Filled out by IDMAP backends */
struct idmap_methods {
/* Called when backend is first loaded */
- NTSTATUS (*init)(void);
+ NTSTATUS (*init)(struct idmap_domain *dom);
+
+ /* Map an array of uids/gids to SIDs. The caller specifies
+ the uid/gid and type. Gets back the SID. */
+ NTSTATUS (*unixids_to_sids)(struct idmap_domain *dom, struct id_map **ids);
+
+ /* Map an arry of SIDs to uids/gids. The caller sets the SID
+ and type and gets back a uid or gid. */
+ NTSTATUS (*sids_to_unixids)(struct idmap_domain *dom, struct id_map **ids);
+
+ NTSTATUS (*set_mapping)(struct idmap_domain *dom, const struct id_map *map);
+ NTSTATUS (*remove_mapping)(struct idmap_domain *dom, const struct id_map *map);
- NTSTATUS (*get_sid_from_id)(DOM_SID *sid, unid_t id, int id_type);
- NTSTATUS (*get_id_from_sid)(unid_t *id, int *id_type, const DOM_SID *sid);
- NTSTATUS (*set_mapping)(DOM_SID *sid, unid_t id, int id_type);
+ /* 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);
/* Called when backend is unloaded */
- NTSTATUS (*close)(void);
+ NTSTATUS (*close_fn)(struct idmap_domain *dom);
+};
+
+struct idmap_alloc_methods {
+
+ /* 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 to dump backend status */
- void (*status)(void);
+ /* Called when backend is unloaded */
+ NTSTATUS (*close_fn)(void);
};
+#endif /* _IDMAP_H_ */