| 1 | /* | 
|---|
| 2 | Unix SMB/CIFS implementation. | 
|---|
| 3 |  | 
|---|
| 4 | Copyright (C) Stefan Metzmacher 2006 | 
|---|
| 5 |  | 
|---|
| 6 | This program is free software; you can redistribute it and/or modify | 
|---|
| 7 | it under the terms of the GNU General Public License as published by | 
|---|
| 8 | the Free Software Foundation; either version 3 of the License, or | 
|---|
| 9 | (at your option) any later version. | 
|---|
| 10 |  | 
|---|
| 11 | This program is distributed in the hope that it will be useful, | 
|---|
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 14 | GNU General Public License for more details. | 
|---|
| 15 |  | 
|---|
| 16 | You should have received a copy of the GNU General Public License | 
|---|
| 17 | along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
|---|
| 18 | */ | 
|---|
| 19 |  | 
|---|
| 20 | #ifndef _LIBCLI_SECURITY_SECURITY_H_ | 
|---|
| 21 | #define _LIBCLI_SECURITY_SECURITY_H_ | 
|---|
| 22 |  | 
|---|
| 23 | #include "librpc/gen_ndr/security.h" | 
|---|
| 24 |  | 
|---|
| 25 | #define PRIMARY_USER_SID_INDEX 0 | 
|---|
| 26 | #define PRIMARY_GROUP_SID_INDEX 1 | 
|---|
| 27 |  | 
|---|
| 28 | /* File Specific access rights */ | 
|---|
| 29 | #define FILE_READ_DATA        SEC_FILE_READ_DATA | 
|---|
| 30 | #define FILE_WRITE_DATA       SEC_FILE_WRITE_DATA | 
|---|
| 31 | #define FILE_APPEND_DATA      SEC_FILE_APPEND_DATA | 
|---|
| 32 | #define FILE_READ_EA          SEC_FILE_READ_EA /* File and directory */ | 
|---|
| 33 | #define FILE_WRITE_EA         SEC_FILE_WRITE_EA /* File and directory */ | 
|---|
| 34 | #define FILE_EXECUTE          SEC_FILE_EXECUTE | 
|---|
| 35 | #define FILE_READ_ATTRIBUTES  SEC_FILE_READ_ATTRIBUTE | 
|---|
| 36 | #define FILE_WRITE_ATTRIBUTES SEC_FILE_WRITE_ATTRIBUTE | 
|---|
| 37 |  | 
|---|
| 38 | #define FILE_ALL_ACCESS       SEC_FILE_ALL | 
|---|
| 39 |  | 
|---|
| 40 | /* Directory specific access rights */ | 
|---|
| 41 | #define FILE_LIST_DIRECTORY   SEC_DIR_LIST | 
|---|
| 42 | #define FILE_ADD_FILE         SEC_DIR_ADD_FILE | 
|---|
| 43 | #define FILE_ADD_SUBDIRECTORY SEC_DIR_ADD_SUBDIR | 
|---|
| 44 | #define FILE_TRAVERSE         SEC_DIR_TRAVERSE | 
|---|
| 45 | #define FILE_DELETE_CHILD     SEC_DIR_DELETE_CHILD | 
|---|
| 46 |  | 
|---|
| 47 | /* Generic access masks & rights. */ | 
|---|
| 48 | #define DELETE_ACCESS        SEC_STD_DELETE       /* (1L<<16) */ | 
|---|
| 49 | #define READ_CONTROL_ACCESS  SEC_STD_READ_CONTROL /* (1L<<17) */ | 
|---|
| 50 | #define WRITE_DAC_ACCESS     SEC_STD_WRITE_DAC    /* (1L<<18) */ | 
|---|
| 51 | #define WRITE_OWNER_ACCESS   SEC_STD_WRITE_OWNER  /* (1L<<19) */ | 
|---|
| 52 | #define SYNCHRONIZE_ACCESS   SEC_STD_SYNCHRONIZE /* (1L<<20) */ | 
|---|
| 53 |  | 
|---|
| 54 | #define SYSTEM_SECURITY_ACCESS SEC_FLAG_SYSTEM_SECURITY /* (1L<<24) */ | 
|---|
| 55 | #define MAXIMUM_ALLOWED_ACCESS SEC_FLAG_MAXIMUM_ALLOWED /* (1L<<25) */ | 
|---|
| 56 | #define GENERIC_ALL_ACCESS     SEC_GENERIC_ALL          /* (1<<28) */ | 
|---|
| 57 | #define GENERIC_EXECUTE_ACCESS SEC_GENERIC_EXECUTE      /* (1<<29) */ | 
|---|
| 58 | #define GENERIC_WRITE_ACCESS   SEC_GENERIC_WRITE        /* (1<<30) */ | 
|---|
| 59 | #define GENERIC_READ_ACCESS    ((unsigned)SEC_GENERIC_READ) /* (((unsigned)1)<<31) */ | 
|---|
| 60 |  | 
|---|
| 61 | /* Mapping of generic access rights for files to specific rights. */ | 
|---|
| 62 |  | 
|---|
| 63 | /* This maps to 0x1F01FF */ | 
|---|
| 64 | #define FILE_GENERIC_ALL (STANDARD_RIGHTS_REQUIRED_ACCESS|\ | 
|---|
| 65 | SEC_STD_SYNCHRONIZE|\ | 
|---|
| 66 | FILE_ALL_ACCESS) | 
|---|
| 67 |  | 
|---|
| 68 | /* This maps to 0x120089 */ | 
|---|
| 69 | #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ_ACCESS|\ | 
|---|
| 70 | FILE_READ_DATA|\ | 
|---|
| 71 | FILE_READ_ATTRIBUTES|\ | 
|---|
| 72 | FILE_READ_EA|\ | 
|---|
| 73 | SYNCHRONIZE_ACCESS) | 
|---|
| 74 |  | 
|---|
| 75 | /* This maps to 0x120116 */ | 
|---|
| 76 | #define FILE_GENERIC_WRITE (SEC_STD_READ_CONTROL|\ | 
|---|
| 77 | FILE_WRITE_DATA|\ | 
|---|
| 78 | FILE_WRITE_ATTRIBUTES|\ | 
|---|
| 79 | FILE_WRITE_EA|\ | 
|---|
| 80 | FILE_APPEND_DATA|\ | 
|---|
| 81 | SYNCHRONIZE_ACCESS) | 
|---|
| 82 |  | 
|---|
| 83 | #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE_ACCESS|\ | 
|---|
| 84 | FILE_READ_ATTRIBUTES|\ | 
|---|
| 85 | FILE_EXECUTE|\ | 
|---|
| 86 | SYNCHRONIZE_ACCESS) | 
|---|
| 87 |  | 
|---|
| 88 | /* Share specific rights. */ | 
|---|
| 89 | #define SHARE_ALL_ACCESS      FILE_GENERIC_ALL | 
|---|
| 90 | #define SHARE_READ_ONLY       (FILE_GENERIC_READ|FILE_EXECUTE) | 
|---|
| 91 |  | 
|---|
| 92 | struct object_tree { | 
|---|
| 93 | uint32_t remaining_access; | 
|---|
| 94 | struct GUID guid; | 
|---|
| 95 | int num_of_children; | 
|---|
| 96 | struct object_tree *children; | 
|---|
| 97 | }; | 
|---|
| 98 |  | 
|---|
| 99 | /* Moved the dom_sid functions to the top level dir with manual proto header */ | 
|---|
| 100 | #include "libcli/security/dom_sid.h" | 
|---|
| 101 | #include "libcli/security/secace.h" | 
|---|
| 102 | #include "libcli/security/secacl.h" | 
|---|
| 103 | #include "libcli/security/security_descriptor.h" | 
|---|
| 104 | #include "libcli/security/security_token.h" | 
|---|
| 105 | #include "libcli/security/sddl.h" | 
|---|
| 106 | #include "libcli/security/privileges.h" | 
|---|
| 107 | #include "libcli/security/access_check.h" | 
|---|
| 108 | #include "libcli/security/session.h" | 
|---|
| 109 | #include "libcli/security/display_sec.h" | 
|---|
| 110 |  | 
|---|
| 111 | #endif | 
|---|