source: vendor/3.6.0/libcli/security/dom_sid.h

Last change on this file was 740, checked in by Silvan Scherrer, 13 years ago

Samba Server: update vendor to 3.6.0

File size: 5.0 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 Samba utility functions
4
5 Copyright (C) Stefan (metze) Metzmacher 2002-2004
6 Copyright (C) Andrew Tridgell 1992-2004
7 Copyright (C) Jeremy Allison 1999
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#ifndef _DOM_SID_H_
24#define _DOM_SID_H_
25
26#include "librpc/gen_ndr/security.h"
27
28/* Some well-known SIDs */
29extern const struct dom_sid global_sid_World_Domain;
30extern const struct dom_sid global_sid_World;
31extern const struct dom_sid global_sid_Creator_Owner_Domain;
32extern const struct dom_sid global_sid_NT_Authority;
33extern const struct dom_sid global_sid_Enterprise_DCs;
34extern const struct dom_sid global_sid_System;
35extern const struct dom_sid global_sid_NULL;
36extern const struct dom_sid global_sid_Authenticated_Users;
37extern const struct dom_sid global_sid_Network;
38extern const struct dom_sid global_sid_Creator_Owner;
39extern const struct dom_sid global_sid_Creator_Group;
40extern const struct dom_sid global_sid_Anonymous;
41extern const struct dom_sid global_sid_Builtin;
42extern const struct dom_sid global_sid_Builtin_Administrators;
43extern const struct dom_sid global_sid_Builtin_Users;
44extern const struct dom_sid global_sid_Builtin_Guests;
45extern const struct dom_sid global_sid_Builtin_Power_Users;
46extern const struct dom_sid global_sid_Builtin_Account_Operators;
47extern const struct dom_sid global_sid_Builtin_Server_Operators;
48extern const struct dom_sid global_sid_Builtin_Print_Operators;
49extern const struct dom_sid global_sid_Builtin_Backup_Operators;
50extern const struct dom_sid global_sid_Builtin_Replicator;
51extern const struct dom_sid global_sid_Builtin_PreWin2kAccess;
52extern const struct dom_sid global_sid_Unix_Users;
53extern const struct dom_sid global_sid_Unix_Groups;
54
55int dom_sid_compare_auth(const struct dom_sid *sid1,
56 const struct dom_sid *sid2);
57int dom_sid_compare(const struct dom_sid *sid1, const struct dom_sid *sid2);
58int dom_sid_compare_domain(const struct dom_sid *sid1,
59 const struct dom_sid *sid2);
60bool dom_sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2);
61bool sid_append_rid(struct dom_sid *sid, uint32_t rid);
62bool string_to_sid(struct dom_sid *sidout, const char *sidstr);
63bool dom_sid_parse_endp(const char *sidstr,struct dom_sid *sidout,
64 const char **endp);
65bool dom_sid_parse(const char *sidstr, struct dom_sid *ret);
66struct dom_sid *dom_sid_parse_talloc(TALLOC_CTX *mem_ctx, const char *sidstr);
67struct dom_sid *dom_sid_parse_length(TALLOC_CTX *mem_ctx, const DATA_BLOB *sid);
68struct dom_sid *dom_sid_dup(TALLOC_CTX *mem_ctx, const struct dom_sid *dom_sid);
69struct dom_sid *dom_sid_add_rid(TALLOC_CTX *mem_ctx,
70 const struct dom_sid *domain_sid,
71 uint32_t rid);
72NTSTATUS dom_sid_split_rid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
73 struct dom_sid **domain, uint32_t *rid);
74bool dom_sid_in_domain(const struct dom_sid *domain_sid,
75 const struct dom_sid *sid);
76
77#define DOM_SID_STR_BUFLEN (15*11+25)
78int dom_sid_string_buf(const struct dom_sid *sid, char *buf, int buflen);
79char *dom_sid_string(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
80
81
82const char *sid_type_lookup(uint32_t sid_type);
83const struct security_token *get_system_token(void);
84bool sid_compose(struct dom_sid *dst, const struct dom_sid *domain_sid, uint32_t rid);
85bool sid_split_rid(struct dom_sid *sid, uint32_t *rid);
86bool sid_peek_rid(const struct dom_sid *sid, uint32_t *rid);
87bool sid_peek_check_rid(const struct dom_sid *exp_dom_sid, const struct dom_sid *sid, uint32_t *rid);
88void sid_copy(struct dom_sid *dst, const struct dom_sid *src);
89bool sid_blob_parse(DATA_BLOB in, struct dom_sid *sid);
90bool sid_parse(const char *inbuf, size_t len, struct dom_sid *sid);
91int sid_compare_domain(const struct dom_sid *sid1, const struct dom_sid *sid2);
92bool sid_equal(const struct dom_sid *sid1, const struct dom_sid *sid2);
93NTSTATUS add_sid_to_array(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
94 struct dom_sid **sids, uint32_t *num);
95NTSTATUS add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const struct dom_sid *sid,
96 struct dom_sid **sids, uint32_t *num_sids);
97void del_sid_from_array(const struct dom_sid *sid, struct dom_sid **sids,
98 uint32_t *num);
99bool add_rid_to_array_unique(TALLOC_CTX *mem_ctx,
100 uint32_t rid, uint32_t **pp_rids, size_t *p_num);
101bool is_null_sid(const struct dom_sid *sid);
102
103#endif /*_DOM_SID_H_*/
104
Note: See TracBrowser for help on using the repository browser.