2 Unix SMB/CIFS implementation.
3 passdb structures and parameters
4 Copyright (C) Gerald Carter 2001
5 Copyright (C) Luke Kenneth Casson Leighton 1998 - 2000
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 /*****************************************************************
27 Functions to be implemented by the new (v2) passdb API
28 ****************************************************************/
31 * This next constant specifies the version number of the PASSDB interface
32 * this SAMBA will load. Increment this if *ANY* changes are made to the interface.
35 #define PASSDB_INTERFACE_VERSION 4
37 /* use this inside a passdb module */
38 #define PDB_MODULE_VERSIONING_MAGIC \
39 int pdb_version(void)\
41 return PASSDB_INTERFACE_VERSION;\
44 typedef struct pdb_context
46 struct pdb_methods
*pdb_methods
;
47 struct pdb_methods
*pwent_methods
;
49 /* These functions are wrappers for the functions listed above.
50 They may do extra things like re-reading a SAM_ACCOUNT on update */
52 NTSTATUS (*pdb_setsampwent
)(struct pdb_context
*, BOOL update
);
54 void (*pdb_endsampwent
)(struct pdb_context
*);
56 NTSTATUS (*pdb_getsampwent
)(struct pdb_context
*, SAM_ACCOUNT
*user
);
58 NTSTATUS (*pdb_getsampwnam
)(struct pdb_context
*, SAM_ACCOUNT
*sam_acct
, const char *username
);
60 NTSTATUS (*pdb_getsampwsid
)(struct pdb_context
*, SAM_ACCOUNT
*sam_acct
, const DOM_SID
*sid
);
62 NTSTATUS (*pdb_add_sam_account
)(struct pdb_context
*, SAM_ACCOUNT
*sampass
);
64 NTSTATUS (*pdb_update_sam_account
)(struct pdb_context
*, SAM_ACCOUNT
*sampass
);
66 NTSTATUS (*pdb_delete_sam_account
)(struct pdb_context
*, SAM_ACCOUNT
*username
);
68 NTSTATUS (*pdb_getgrsid
)(struct pdb_context
*context
, GROUP_MAP
*map
,
69 DOM_SID sid
, BOOL with_priv
);
71 NTSTATUS (*pdb_getgrgid
)(struct pdb_context
*context
, GROUP_MAP
*map
,
72 gid_t gid
, BOOL with_priv
);
74 NTSTATUS (*pdb_getgrnam
)(struct pdb_context
*context
, GROUP_MAP
*map
,
75 char *name
, BOOL with_priv
);
77 NTSTATUS (*pdb_add_group_mapping_entry
)(struct pdb_context
*context
,
80 NTSTATUS (*pdb_update_group_mapping_entry
)(struct pdb_context
*context
,
83 NTSTATUS (*pdb_delete_group_mapping_entry
)(struct pdb_context
*context
,
86 NTSTATUS (*pdb_enum_group_mapping
)(struct pdb_context
*context
,
87 enum SID_NAME_USE sid_name_use
,
88 GROUP_MAP
**rmap
, int *num_entries
,
89 BOOL unix_only
, BOOL with_priv
);
91 void (*free_fn
)(struct pdb_context
**);
97 typedef struct pdb_methods
99 const char *name
; /* What name got this module */
100 struct pdb_context
*parent
;
102 /* Use macros from dlinklist.h on these two */
103 struct pdb_methods
*next
;
104 struct pdb_methods
*prev
;
106 NTSTATUS (*setsampwent
)(struct pdb_methods
*, BOOL update
);
108 void (*endsampwent
)(struct pdb_methods
*);
110 NTSTATUS (*getsampwent
)(struct pdb_methods
*, SAM_ACCOUNT
*user
);
112 NTSTATUS (*getsampwnam
)(struct pdb_methods
*, SAM_ACCOUNT
*sam_acct
, const char *username
);
114 NTSTATUS (*getsampwsid
)(struct pdb_methods
*, SAM_ACCOUNT
*sam_acct
, const DOM_SID
*Sid
);
116 NTSTATUS (*add_sam_account
)(struct pdb_methods
*, SAM_ACCOUNT
*sampass
);
118 NTSTATUS (*update_sam_account
)(struct pdb_methods
*, SAM_ACCOUNT
*sampass
);
120 NTSTATUS (*delete_sam_account
)(struct pdb_methods
*, SAM_ACCOUNT
*username
);
122 NTSTATUS (*getgrsid
)(struct pdb_methods
*methods
, GROUP_MAP
*map
,
123 DOM_SID sid
, BOOL with_priv
);
125 NTSTATUS (*getgrgid
)(struct pdb_methods
*methods
, GROUP_MAP
*map
,
126 gid_t gid
, BOOL with_priv
);
128 NTSTATUS (*getgrnam
)(struct pdb_methods
*methods
, GROUP_MAP
*map
,
129 char *name
, BOOL with_priv
);
131 NTSTATUS (*add_group_mapping_entry
)(struct pdb_methods
*methods
,
134 NTSTATUS (*update_group_mapping_entry
)(struct pdb_methods
*methods
,
137 NTSTATUS (*delete_group_mapping_entry
)(struct pdb_methods
*methods
,
140 NTSTATUS (*enum_group_mapping
)(struct pdb_methods
*methods
,
141 enum SID_NAME_USE sid_name_use
,
142 GROUP_MAP
**rmap
, int *num_entries
,
143 BOOL unix_only
, BOOL with_priv
);
145 void *private_data
; /* Private data of some kind */
147 void (*free_private_data
)(void **);
151 typedef NTSTATUS (*pdb_init_function
)(struct pdb_context
*,
152 struct pdb_methods
**,
155 struct pdb_init_function_entry
{
157 /* Function to create a member of the pdb_methods list */
158 pdb_init_function init
;
161 #endif /* _PASSDB_H */