2 Unix SMB/CIFS implementation.
3 Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 %module(package="samba.security") security
23 #include "libcli/security/security.h"
25 typedef struct dom_sid dom_sid;
26 typedef struct security_token security_token;
27 typedef struct security_descriptor security_descriptor;
30 %import "../../lib/talloc/talloc.i"
31 %import "../util/errors.i"
38 SEC_PRIV_SYSTEMTIME=4,
40 SEC_PRIV_REMOTE_SHUTDOWN=6,
41 SEC_PRIV_TAKE_OWNERSHIP=7,
43 SEC_PRIV_SYSTEM_ENVIRONMENT=9,
44 SEC_PRIV_SYSTEM_PROFILE=10,
45 SEC_PRIV_PROFILE_SINGLE_PROCESS=11,
46 SEC_PRIV_INCREASE_BASE_PRIORITY=12,
47 SEC_PRIV_LOAD_DRIVER=13,
48 SEC_PRIV_CREATE_PAGEFILE=14,
49 SEC_PRIV_INCREASE_QUOTA=15,
50 SEC_PRIV_CHANGE_NOTIFY=16,
52 SEC_PRIV_MANAGE_VOLUME=18,
53 SEC_PRIV_IMPERSONATE=19,
54 SEC_PRIV_CREATE_GLOBAL=20,
55 SEC_PRIV_ENABLE_DELEGATION=21,
56 SEC_PRIV_INTERACTIVE_LOGON=22,
57 SEC_PRIV_NETWORK_LOGON=23,
58 SEC_PRIV_REMOTE_INTERACTIVE_LOGON=24
61 %rename(SecurityToken) security_token;
63 %talloctype(security_token);
65 typedef struct security_token {
67 security_token(TALLOC_CTX *mem_ctx) { return security_token_initialise(mem_ctx); }
68 bool is_sid(const struct dom_sid *sid);
71 bool has_sid(const struct dom_sid *sid);
72 bool has_builtin_administrators();
73 bool has_nt_authenticated_users();
74 bool has_privilege(enum sec_privilege privilege);
75 void set_privilege(enum sec_privilege privilege);
79 %talloctype(security_descriptor);
81 typedef struct security_descriptor {
83 security_descriptor(TALLOC_CTX *mem_ctx) { return security_descriptor_initialise(mem_ctx); }
84 NTSTATUS sacl_add(const struct security_ace *ace);
85 NTSTATUS dacl_add(const struct security_ace *ace);
86 NTSTATUS dacl_del(const struct security_ace *ace);
87 NTSTATUS sacl_del(const struct security_ace *ace);
89 %rename(__eq__) equal;
91 bool equal(const struct security_descriptor *other);
93 } security_descriptor;
99 typedef struct dom_sid {
101 dom_sid(TALLOC_CTX *mem_ctx, const char *text) {
102 return dom_sid_parse_talloc(mem_ctx, text);
105 const char *__str__(TALLOC_CTX *mem_ctx) {
106 return dom_sid_string(mem_ctx, $self);
108 %rename(__eq__) equal;
110 bool equal(const struct dom_sid *other);
115 static struct dom_sid *random_sid(TALLOC_CTX *mem_ctx)
117 char *str = talloc_asprintf(mem_ctx, "S-1-5-21-%u-%u-%u",
118 (unsigned)generate_random(),
119 (unsigned)generate_random(),
120 (unsigned)generate_random());
122 return dom_sid_parse_talloc(mem_ctx, str);
126 %rename(privilege_name) sec_privilege_name;
127 const char *sec_privilege_name(enum sec_privilege privilege);
128 %rename(privilege_id) sec_privilege_id;
129 enum sec_privilege sec_privilege_id(const char *name);