Add two flags to allow for handling of Extended Signatures (Session Key Protection...
[kai/samba.git] / source3 / include / idmap.h
index ee248ef26f2895ce62416f00eb64ea13ef1d08f0..800e69421dc5d9a7549d117c6824e18733b28cb7 100644 (file)
@@ -7,54 +7,58 @@
 
    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
-   modify it under the terms of the GNU Library General Public
+   modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-   
+   version 3 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.   
-*/
 
-/* idmap version determines auto-conversion - this is the database
-   structure version specifier. */
-
-#define IDMAP_VERSION 2
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
 
 /* The interface version specifier. 
    Updated to 3 for enum types by JRA. */
 
-#define SMB_IDMAP_INTERFACE_VERSION    3
+/* Updated to 4, completely new interface, SSS */
+/* Updated to 5, simplified interface by Volker */
 
-enum idmap_type { ID_USERID, ID_GROUPID };
+#define SMB_IDMAP_INTERFACE_VERSION 5
 
-#define IDMAP_FLAG_NONE                0x0
-#define IDMAP_FLAG_QUERY_ONLY  0x1     /* Don't ever allocate, just query. */
-#define IDMAP_FLAG_CACHE_ONLY   0x2    /* Only look in our local cache, not remote. */
+#include "librpc/gen_ndr/idmap.h"
+
+struct idmap_domain {
+       const char *name;
+       struct idmap_methods *methods;
+       uint32_t low_id;
+       uint32_t high_id;
+       bool read_only;
+       void *private_data;
+};
 
 /* Filled out by IDMAP backends */
 struct idmap_methods {
 
        /* Called when backend is first loaded */
-       NTSTATUS (*init)( const char *params );
+       NTSTATUS (*init)(struct idmap_domain *dom);
 
-       NTSTATUS (*allocate_id)(unid_t *id, enum idmap_type id_type);
-       NTSTATUS (*get_sid_from_id)(DOM_SID *sid, unid_t id, enum idmap_type id_type, int flags);
-       NTSTATUS (*get_id_from_sid)(unid_t *id, enum idmap_type *id_type, const DOM_SID *sid, int flags);
-       NTSTATUS (*set_mapping)(const DOM_SID *sid, unid_t id, enum idmap_type id_type);
+       /* 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);
 
-       /* Called when backend is unloaded */
-       NTSTATUS (*close_fn)(void);
+       /* 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);
 
-       /* Called to dump backend status */
-       void (*status)(void);
+       /* Allocate a Unix-ID. */
+       NTSTATUS (*allocate_id)(struct idmap_domain *dom, struct unixid *id);
 };
+
+#include "winbindd/idmap_proto.h"
+
 #endif /* _IDMAP_H_ */