Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16
[kai/samba.git] / source3 / groupdb / proto.h
1 /*
2  *  Unix SMB/CIFS implementation.
3  *  Group Mapping Database
4  *
5  *  Copyright (C) Andrew Tridgell              1992-2006
6  *  Copyright (C) Jean François Micouleau      1998-2001
7  *  Copyright (C) Gerald Carter                2006
8  *  Copyright (C) Volker Lendecke              2006
9  *
10  *  This program is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU General Public License as published by
12  *  the Free Software Foundation; either version 3 of the License, or
13  *  (at your option) any later version.
14  *
15  *  This program is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU General Public License for more details.
19  *
20  *  You should have received a copy of the GNU General Public License
21  *  along with this program; if not, see <http://www.gnu.org/licenses/>.
22  */
23
24 #ifndef _GROUPDB_PROTO_H_
25 #define _GROUPDB_PROTO_H_
26
27 /* The following definitions come from groupdb/mapping.c  */
28
29 NTSTATUS add_initial_entry(gid_t gid, const char *sid, enum lsa_SidType sid_name_use, const char *nt_name, const char *comment);
30 bool get_domain_group_from_sid(struct dom_sid sid, GROUP_MAP *map);
31 int smb_create_group(const char *unix_group, gid_t *new_gid);
32 int smb_delete_group(const char *unix_group);
33 int smb_set_primary_group(const char *unix_group, const char* unix_user);
34 int smb_add_user_group(const char *unix_group, const char *unix_user);
35 int smb_delete_user_group(const char *unix_group, const char *unix_user);
36 NTSTATUS pdb_default_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
37                                  struct dom_sid sid);
38 NTSTATUS pdb_default_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
39                                  gid_t gid);
40 NTSTATUS pdb_default_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
41                                  const char *name);
42 NTSTATUS pdb_default_add_group_mapping_entry(struct pdb_methods *methods,
43                                                 GROUP_MAP *map);
44 NTSTATUS pdb_default_update_group_mapping_entry(struct pdb_methods *methods,
45                                                    GROUP_MAP *map);
46 NTSTATUS pdb_default_delete_group_mapping_entry(struct pdb_methods *methods,
47                                                    struct dom_sid sid);
48 NTSTATUS pdb_default_enum_group_mapping(struct pdb_methods *methods,
49                                            const struct dom_sid *sid, enum lsa_SidType sid_name_use,
50                                            GROUP_MAP **pp_rmap, size_t *p_num_entries,
51                                            bool unix_only);
52 NTSTATUS pdb_default_create_alias(struct pdb_methods *methods,
53                                   const char *name, uint32 *rid);
54 NTSTATUS pdb_default_delete_alias(struct pdb_methods *methods,
55                                   const struct dom_sid *sid);
56 struct acct_info;
57 NTSTATUS pdb_default_get_aliasinfo(struct pdb_methods *methods,
58                                    const struct dom_sid *sid,
59                                    struct acct_info *info);
60 NTSTATUS pdb_default_set_aliasinfo(struct pdb_methods *methods,
61                                    const struct dom_sid *sid,
62                                    struct acct_info *info);
63 NTSTATUS pdb_default_add_aliasmem(struct pdb_methods *methods,
64                                   const struct dom_sid *alias, const struct dom_sid *member);
65 NTSTATUS pdb_default_del_aliasmem(struct pdb_methods *methods,
66                                   const struct dom_sid *alias, const struct dom_sid *member);
67 NTSTATUS pdb_default_enum_aliasmem(struct pdb_methods *methods,
68                                    const struct dom_sid *alias, TALLOC_CTX *mem_ctx,
69                                    struct dom_sid **pp_members,
70                                    size_t *p_num_members);
71 NTSTATUS pdb_default_alias_memberships(struct pdb_methods *methods,
72                                        TALLOC_CTX *mem_ctx,
73                                        const struct dom_sid *domain_sid,
74                                        const struct dom_sid *members,
75                                        size_t num_members,
76                                        uint32 **pp_alias_rids,
77                                        size_t *p_num_alias_rids);
78 NTSTATUS pdb_nop_getgrsid(struct pdb_methods *methods, GROUP_MAP *map,
79                                  struct dom_sid sid);
80 NTSTATUS pdb_nop_getgrgid(struct pdb_methods *methods, GROUP_MAP *map,
81                                  gid_t gid);
82 NTSTATUS pdb_nop_getgrnam(struct pdb_methods *methods, GROUP_MAP *map,
83                                  const char *name);
84 NTSTATUS pdb_nop_add_group_mapping_entry(struct pdb_methods *methods,
85                                                 GROUP_MAP *map);
86 NTSTATUS pdb_nop_update_group_mapping_entry(struct pdb_methods *methods,
87                                                    GROUP_MAP *map);
88 NTSTATUS pdb_nop_delete_group_mapping_entry(struct pdb_methods *methods,
89                                                    struct dom_sid sid);
90 NTSTATUS pdb_nop_enum_group_mapping(struct pdb_methods *methods,
91                                            enum lsa_SidType sid_name_use,
92                                            GROUP_MAP **rmap, size_t *num_entries,
93                                            bool unix_only);
94 bool pdb_get_dom_grp_info(const struct dom_sid *sid, struct acct_info *info);
95 bool pdb_set_dom_grp_info(const struct dom_sid *sid, const struct acct_info *info);
96 NTSTATUS pdb_create_builtin_alias(uint32 rid);
97
98 /* The following definitions come from groupdb/mapping_tdb.c  */
99
100 const struct mapping_backend *groupdb_tdb_init(void);
101
102 #endif /* _GROUPDB_PROTO_H_ */