s4:lib/messaging: terminate the irpc_servers_byname() result with server_id_set_disco...
[Samba/gebeck_regimport.git] / source3 / passdb / lookup_sid.h
blob872f4ef0bae632a57459e274480ba3c0e60005eb
1 /*
2 Unix SMB/CIFS implementation.
3 uid/user handling
4 Copyright (C) Andrew Tridgell 1992-1998
5 Copyright (C) Gerald (Jerry) Carter 2003
6 Copyright (C) Volker Lendecke 2005
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #ifndef _PASSDB_LOOKUP_SID_H_
24 #define _PASSDB_LOOKUP_SID_H_
26 #include "../librpc/gen_ndr/lsa.h"
28 struct passwd;
29 struct unixid;
31 #define LOOKUP_NAME_NONE 0x00000000
32 #define LOOKUP_NAME_ISOLATED 0x00000001 /* Look up unqualified names */
33 #define LOOKUP_NAME_REMOTE 0x00000002 /* Ask others */
34 #define LOOKUP_NAME_GROUP 0x00000004 /* (unused) This is a NASTY hack for
35 valid users = @foo where foo also
36 exists in as user. */
37 #define LOOKUP_NAME_NO_NSS 0x00000008 /* no NSS calls to avoid
38 winbind recursions */
39 #define LOOKUP_NAME_BUILTIN 0x00000010 /* builtin names */
40 #define LOOKUP_NAME_WKN 0x00000020 /* well known names */
41 #define LOOKUP_NAME_DOMAIN 0x00000040 /* only lookup own domain */
42 #define LOOKUP_NAME_LOCAL (LOOKUP_NAME_ISOLATED\
43 |LOOKUP_NAME_BUILTIN\
44 |LOOKUP_NAME_WKN\
45 |LOOKUP_NAME_DOMAIN)
46 #define LOOKUP_NAME_ALL (LOOKUP_NAME_ISOLATED\
47 |LOOKUP_NAME_REMOTE\
48 |LOOKUP_NAME_BUILTIN\
49 |LOOKUP_NAME_WKN\
50 |LOOKUP_NAME_DOMAIN)
52 struct lsa_dom_info {
53 bool valid;
54 struct dom_sid sid;
55 const char *name;
56 int num_idxs;
57 int *idxs;
60 struct lsa_name_info {
61 uint32_t rid;
62 enum lsa_SidType type;
63 const char *name;
64 int dom_idx;
67 /* The following definitions come from passdb/lookup_sid.c */
69 bool lookup_name(TALLOC_CTX *mem_ctx,
70 const char *full_name, int flags,
71 const char **ret_domain, const char **ret_name,
72 struct dom_sid *ret_sid, enum lsa_SidType *ret_type);
73 bool lookup_name_smbconf(TALLOC_CTX *mem_ctx,
74 const char *full_name, int flags,
75 const char **ret_domain, const char **ret_name,
76 struct dom_sid *ret_sid, enum lsa_SidType *ret_type);
77 NTSTATUS lookup_sids(TALLOC_CTX *mem_ctx, int num_sids,
78 const struct dom_sid **sids, int level,
79 struct lsa_dom_info **ret_domains,
80 struct lsa_name_info **ret_names);
81 bool lookup_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
82 const char **ret_domain, const char **ret_name,
83 enum lsa_SidType *ret_type);
84 void uid_to_sid(struct dom_sid *psid, uid_t uid);
85 void gid_to_sid(struct dom_sid *psid, gid_t gid);
86 bool sid_to_uid(const struct dom_sid *psid, uid_t *puid);
87 bool sid_to_gid(const struct dom_sid *psid, gid_t *pgid);
88 bool sids_to_unixids(const struct dom_sid *sids, uint32_t num_sids,
89 struct unixid *ids);
90 NTSTATUS get_primary_group_sid(TALLOC_CTX *mem_ctx,
91 const char *username,
92 struct passwd **_pwd,
93 struct dom_sid **_group_sid);
95 #endif /* _PASSDB_LOOKUP_SID_H_ */