libsmack  1.3.0
smack.h
Go to the documentation of this file.
1 /*
2  * This file is part of libsmack
3  *
4  * Copyright (C) 2010, 2011 Nokia Corporation
5  * Copyright (C) 2011, 2012, 2013 Intel Corporation
6  * Copyright (C) 2012, 2013 Samsung Electronics Co.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public License
10  * version 2.1 as published by the Free Software Foundation.
11  *
12  * This library is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20  * 02110-1301 USA
21  */
22 
27 #ifndef _SYS_SMACK_H
28 #define _SYS_SMACK_H
29 
30 #include <sys/types.h>
31 
35 #define SMACK_LABEL_LEN 255
36 
40 struct smack_accesses;
41 
45 struct smack_cipso;
46 
47 #ifdef __cplusplus
48 extern "C" {
49 #endif
50 
59 int smack_accesses_new(struct smack_accesses **handle);
60 
66 void smack_accesses_free(struct smack_accesses *handle);
67 
75 int smack_accesses_save(struct smack_accesses *handle, int fd);
76 
84 int smack_accesses_apply(struct smack_accesses *handle);
85 
94 int smack_accesses_clear(struct smack_accesses *handle);
95 
105 int smack_accesses_add(struct smack_accesses *handle, const char *subject,
106  const char *object, const char *access_type);
107 
124 int smack_accesses_add_modify(struct smack_accesses *handle,
125  const char *subject,
126  const char *object,
127  const char *allow_access_type,
128  const char *deny_access_type);
129 
137 int smack_accesses_add_from_file(struct smack_accesses *handle, int fd);
138 
149 int smack_have_access(const char *subject, const char *object,
150  const char *access_type);
151 
160 int smack_cipso_new(struct smack_cipso **handle);
161 
167 void smack_cipso_free(struct smack_cipso *handle);
168 
175 int smack_cipso_apply(struct smack_cipso *handle);
176 
184 int smack_cipso_add_from_file(struct smack_cipso *handle, int fd);
185 
192 const char *smack_smackfs_path(void);
193 
202 ssize_t smack_new_label_from_self(char **label);
203 
213 ssize_t smack_new_label_from_process(pid_t pid, char **label);
214 
225 ssize_t smack_new_label_from_socket(int fd, char **label);
226 
238 ssize_t smack_new_label_from_path(const char *path,
239  const char *xattr,
240  int follow,
241  char **label);
242 
253 ssize_t smack_new_label_from_file(int fd,
254  const char *xattr,
255  char **label);
256 
266 int smack_set_label_for_path(const char *path,
267  const char *xattr,
268  int follow,
269  const char *label);
270 
279 int smack_set_label_for_file(int fd,
280  const char *xattr,
281  const char *label);
282 
291 int smack_remove_label_for_path(const char *path,
292  const char *xattr,
293  int follow);
294 
302 int smack_remove_label_for_file(int fd, const char *xattr);
303 
311 int smack_set_label_for_self(const char *label);
312 
319 int smack_revoke_subject(const char *subject);
320 
327 ssize_t smack_label_length(const char *label);
328 
338 int smack_load_policy(void);
339 
351 int smack_set_relabel_self(const char **labels, int cnt);
352 
368 int smack_set_onlycap(const char **labels, int cnt);
369 
370 
379 int smack_set_onlycap_from_file(int fd);
380 
381 #ifdef __cplusplus
382 }
383 #endif
384 
385 #endif // _SYS_SMACK_H
void smack_accesses_free(struct smack_accesses *handle)
int smack_set_label_for_self(const char *label)
int smack_set_relabel_self(const char **labels, int cnt)
int smack_cipso_new(struct smack_cipso **handle)
int smack_set_onlycap(const char **labels, int cnt)
int smack_set_onlycap_from_file(int fd)
int smack_set_label_for_path(const char *path, const char *xattr, int follow, const char *label)
ssize_t smack_new_label_from_self(char **label)
int smack_accesses_save(struct smack_accesses *handle, int fd)
int smack_accesses_add_from_file(struct smack_accesses *handle, int fd)
int smack_accesses_apply(struct smack_accesses *handle)
int smack_accesses_new(struct smack_accesses **handle)
int smack_revoke_subject(const char *subject)
int smack_have_access(const char *subject, const char *object, const char *access_type)
int smack_remove_label_for_file(int fd, const char *xattr)
void smack_cipso_free(struct smack_cipso *handle)
ssize_t smack_new_label_from_file(int fd, const char *xattr, char **label)
ssize_t smack_new_label_from_process(pid_t pid, char **label)
int smack_accesses_clear(struct smack_accesses *handle)
ssize_t smack_label_length(const char *label)
ssize_t smack_new_label_from_path(const char *path, const char *xattr, int follow, char **label)
int smack_cipso_apply(struct smack_cipso *handle)
int smack_cipso_add_from_file(struct smack_cipso *handle, int fd)
int smack_accesses_add_modify(struct smack_accesses *handle, const char *subject, const char *object, const char *allow_access_type, const char *deny_access_type)
ssize_t smack_new_label_from_socket(int fd, char **label)
int smack_set_label_for_file(int fd, const char *xattr, const char *label)
const char * smack_smackfs_path(void)
int smack_remove_label_for_path(const char *path, const char *xattr, int follow)
int smack_load_policy(void)
int smack_accesses_add(struct smack_accesses *handle, const char *subject, const char *object, const char *access_type)