apply sdbd smack rule
[platform/core/system/sdbd.git] / src / sdktools.h
1 #ifndef _SDKTOOLS_H
2 #define _SDKTOOLS_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 struct sudo_command
9 {
10   const char *command;
11   const char *path;
12   //const char *arguments;
13   //const char *regx;
14   //int   permission; /* 0: root, 1: developer, 2: app*/
15 };
16
17
18 struct arg_permit_rule
19 {
20     const char *name;
21     const char *pattern;
22     int expression; // 0:compare, 1: regx
23 };
24
25
26 #define APP_INSTALL_PATH_PREFIX1                "/opt/apps"
27 #define APP_INSTALL_PATH_PREFIX2                "/opt/usr/apps"
28 #define GDBSERVER_PATH                          "/home/developer/sdk_tools/gdbserver/gdbserver"
29 #define SMACK_LEBEL_SUBJECT_PATH                "/proc/self/attr/current"
30 #define APP_GROUPS_MAX                          100
31 #define APP_GROUP_LIST                          "/usr/share/privilege-control/app_group_list"
32 #define APPID_MAX_LENGTH                        10
33 #define SDBD_LABEL_NAME                          "sdbd"
34 #define SDK_HOME_LABEL_NAME                      "sdbd::home"
35
36 int verify_commands(const char *arg1);
37 int verify_root_commands(const char *arg1);
38 int verify_app_path(const char* path);
39 int regcmp(const char* pattern, const char* str);
40 int exec_app_standalone(const char* path);
41 char* clone_gdbserver_label_from_app(const char* app_path);
42 int set_smack_rules_for_gdbserver(const char* apppath, int mode);
43 void apply_app_process();
44 void set_appuser_groups(void);
45 int is_root_commands(const char *command);
46 int apply_sdb_rules(const char* subject, const char* object, const char* access_type);
47
48 #ifdef __cplusplus
49 }
50 #endif
51
52 #endif