15331Samw /* 25331Samw * CDDL HEADER START 35331Samw * 45331Samw * The contents of this file are subject to the terms of the 55331Samw * Common Development and Distribution License (the "License"). 65331Samw * You may not use this file except in compliance with the License. 75331Samw * 85331Samw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 95331Samw * or http://www.opensolaris.org/os/licensing. 105331Samw * See the License for the specific language governing permissions 115331Samw * and limitations under the License. 125331Samw * 135331Samw * When distributing Covered Code, include this CDDL HEADER in each 145331Samw * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 155331Samw * If applicable, add the following below this CDDL HEADER, with the 165331Samw * fields enclosed by brackets "[]" replaced with your own identifying 175331Samw * information: Portions Copyright [yyyy] [name of copyright owner] 185331Samw * 195331Samw * CDDL HEADER END 205331Samw */ 215331Samw /* 22*8670SJose.Borrego@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 235331Samw * Use is subject to license terms. 245331Samw */ 255331Samw 265331Samw #ifndef _SMB_PRIVILEGE_H 275331Samw #define _SMB_PRIVILEGE_H 285331Samw 295331Samw #ifdef __cplusplus 305331Samw extern "C" { 315331Samw #endif 325331Samw 335331Samw /* 345331Samw * Privileges 355331Samw * 365331Samw * Privileges apply to all objects and over-ride the access controls 375331Samw * in an object's security descriptor in a manner specific to each 385331Samw * privilege. Privileges are still not full defined. Privileges are 395331Samw * defined in a set structure (LUID = Locally Unique Identifier). 405331Samw * 415331Samw * The default LUID, name and display names defined on NT 4.0 are: 425331Samw * LUID Privilege Name Display Name 435331Samw * ---- -------------- ------------ 445331Samw * 0:2 SeCreateTokenPrivilege Create a token object 455331Samw * 0:3 SeAssignPrimaryTokenPrivilege Replace a process level token 465331Samw * 0:4 SeLockMemoryPrivilege Lock pages in memory 475331Samw * 0:5 SeIncreaseQuotaPrivilege Increase quotas 485331Samw * 0:6 SeMachineAccountPrivilege Add workstations to domain 495331Samw * 0:7 SeTcbPrivilege Act as part of the operating system 505331Samw * 0:8 SeSecurityPrivilege Manage auditing and security log 515331Samw * 0:9 SeTakeOwnershipPrivilege Take ownership of files or other objects 525331Samw * 0:10 SeLoadDriverPrivilege Load and unload device drivers 535331Samw * 0:11 SeSystemProfilePrivilege Profile system performance 545331Samw * 0:12 SeSystemtimePrivilege Change the system time 555331Samw * 0:13 SeProfileSingleProcessPrivilege Profile single process 565331Samw * 0:14 SeIncreaseBasePriorityPrivilege Increase scheduling priority 575331Samw * 0:15 SeCreatePagefilePrivilege Create a pagefile 585331Samw * 0:16 SeCreatePermanentPrivilege Create permanent shared objects 595331Samw * 0:17 SeBackupPrivilege Back up files and directories 605331Samw * 0:18 SeRestorePrivilege Restore files and directories 615331Samw * 0:19 SeShutdownPrivilege Shut down the system 625331Samw * 0:20 SeDebugPrivilege Debug programs 635331Samw * 0:21 SeAuditPrivilege Generate security audits 645331Samw * 0:22 SeSystemEnvironmentPrivilege Modify firmware environment values 655331Samw * 0:23 SeChangeNotifyPrivilege Bypass traverse checking 665331Samw * 0:24 SeRemoteShutdownPrivilege Force shutdown from a remote system 675331Samw */ 685331Samw 695331Samw /* 705331Samw * Privilege names 715331Samw */ 725331Samw #define SE_CREATE_TOKEN_NAME "SeCreateTokenPrivilege" 735331Samw #define SE_ASSIGNPRIMARYTOKEN_NAME "SeAssignPrimaryTokenPrivilege" 745331Samw #define SE_LOCK_MEMORY_NAME "SeLockMemoryPrivilege" 755331Samw #define SE_INCREASE_QUOTA_NAME "SeIncreaseQuotaPrivilege" 765331Samw #define SE_UNSOLICITED_INPUT_NAME "SeUnsolicitedInputPrivilege" 775331Samw #define SE_MACHINE_ACCOUNT_NAME "SeMachineAccountPrivilege" 785331Samw #define SE_TCB_NAME "SeTcbPrivilege" 795331Samw #define SE_SECURITY_NAME "SeSecurityPrivilege" 805331Samw #define SE_TAKE_OWNERSHIP_NAME "SeTakeOwnershipPrivilege" 815331Samw #define SE_LOAD_DRIVER_NAME "SeLoadDriverPrivilege" 825331Samw #define SE_SYSTEM_PROFILE_NAME "SeSystemProfilePrivilege" 835331Samw #define SE_SYSTEMTIME_NAME "SeSystemtimePrivilege" 845331Samw #define SE_PROF_SINGLE_PROCESS_NAME "SeProfileSingleProcessPrivilege" 855331Samw #define SE_INC_BASE_PRIORITY_NAME "SeIncreaseBasePriorityPrivilege" 865331Samw #define SE_CREATE_PAGEFILE_NAME "SeCreatePagefilePrivilege" 875331Samw #define SE_CREATE_PERMANENT_NAME "SeCreatePermanentPrivilege" 885331Samw #define SE_BACKUP_NAME "SeBackupPrivilege" 895331Samw #define SE_RESTORE_NAME "SeRestorePrivilege" 905331Samw #define SE_SHUTDOWN_NAME "SeShutdownPrivilege" 915331Samw #define SE_DEBUG_NAME "SeDebugPrivilege" 925331Samw #define SE_AUDIT_NAME "SeAuditPrivilege" 935331Samw #define SE_SYSTEM_ENVIRONMENT_NAME "SeSystemEnvironmentPrivilege" 945331Samw #define SE_CHANGE_NOTIFY_NAME "SeChangeNotifyPrivilege" 955331Samw #define SE_REMOTE_SHUTDOWN_NAME "SeRemoteShutdownPrivilege" 965331Samw 975772Sas200622 #define SE_MIN_LUID 2 985331Samw #define SE_CREATE_TOKEN_LUID 2 995331Samw #define SE_ASSIGNPRIMARYTOKEN_LUID 3 1005331Samw #define SE_LOCK_MEMORY_LUID 4 1015331Samw #define SE_INCREASE_QUOTA_LUID 5 1025331Samw #define SE_MACHINE_ACCOUNT_LUID 6 1035331Samw #define SE_TCB_LUID 7 1045331Samw #define SE_SECURITY_LUID 8 1055331Samw #define SE_TAKE_OWNERSHIP_LUID 9 1065331Samw #define SE_LOAD_DRIVER_LUID 10 1075331Samw #define SE_SYSTEM_PROFILE_LUID 11 1085331Samw #define SE_SYSTEMTIME_LUID 12 1095331Samw #define SE_PROF_SINGLE_PROCESS_LUID 13 1105331Samw #define SE_INC_BASE_PRIORITY_LUID 14 1115331Samw #define SE_CREATE_PAGEFILE_LUID 15 1125331Samw #define SE_CREATE_PERMANENT_LUID 16 1135331Samw #define SE_BACKUP_LUID 17 1145331Samw #define SE_RESTORE_LUID 18 1155331Samw #define SE_SHUTDOWN_LUID 19 1165331Samw #define SE_DEBUG_LUID 20 1175331Samw #define SE_AUDIT_LUID 21 1185331Samw #define SE_SYSTEM_ENVIRONMENT_LUID 22 1195331Samw #define SE_CHANGE_NOTIFY_LUID 23 1205331Samw #define SE_REMOTE_SHUTDOWN_LUID 24 1215772Sas200622 #define SE_MAX_LUID 24 1225331Samw 1235331Samw /* 1245331Samw * Privilege attributes 1255331Samw */ 1265331Samw #define SE_PRIVILEGE_DISABLED 0x00000000 1275331Samw #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001 1285331Samw #define SE_PRIVILEGE_ENABLED 0x00000002 1295331Samw #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000 1305331Samw 1315331Samw /* 1325331Samw * Privilege Set Control flags 1335331Samw */ 1345331Samw #define PRIVILEGE_SET_ALL_NECESSARY 1 1355331Samw 1365331Samw typedef struct smb_luid { 1375331Samw uint32_t lo_part; 1385331Samw uint32_t hi_part; 1395331Samw } smb_luid_t; 1405331Samw 1415331Samw 1425331Samw typedef struct smb_luid_attrs { 1435331Samw smb_luid_t luid; 1445331Samw uint32_t attrs; 1455331Samw } smb_luid_attrs_t; 1465331Samw 1475331Samw 1485331Samw typedef struct smb_privset { 1495331Samw uint32_t priv_cnt; 1505331Samw uint32_t control; 1515331Samw smb_luid_attrs_t priv[ANY_SIZE_ARRAY]; 1525331Samw } smb_privset_t; 1535331Samw 1545331Samw /* 1555331Samw * These are possible value for smb_privinfo_t.flags 1565331Samw * 1575331Samw * PF_PRESENTABLE Privilege is user visible 1585331Samw */ 1595331Samw #define PF_PRESENTABLE 0x1 1605331Samw 1615331Samw /* 1625331Samw * Structure for passing privilege name and id information around within 1635331Samw * the system. Note that we are only storing the low uint32_t of the LUID; 1645331Samw * the high part is always zero here. 1655331Samw */ 1665331Samw typedef struct smb_privinfo { 1675331Samw uint32_t id; 1685331Samw char *name; 1695331Samw char *display_name; 1705331Samw uint16_t flags; 1715331Samw } smb_privinfo_t; 1725331Samw 1735331Samw smb_privinfo_t *smb_priv_getbyvalue(uint32_t id); 1745331Samw smb_privinfo_t *smb_priv_getbyname(char *name); 1755331Samw int smb_priv_presentable_num(void); 1765331Samw int smb_priv_presentable_ids(uint32_t *ids, int num); 1775331Samw smb_privset_t *smb_privset_new(); 1785331Samw int smb_privset_size(); 1795331Samw void smb_privset_init(smb_privset_t *privset); 1805331Samw void smb_privset_free(smb_privset_t *privset); 1815331Samw void smb_privset_copy(smb_privset_t *dst, smb_privset_t *src); 1825772Sas200622 void smb_privset_merge(smb_privset_t *dst, smb_privset_t *src); 1835331Samw void smb_privset_enable(smb_privset_t *privset, uint32_t id); 1845331Samw int smb_privset_query(smb_privset_t *privset, uint32_t id); 1855331Samw void smb_privset_log(smb_privset_t *privset); 1865331Samw 1875331Samw #ifdef __cplusplus 1885331Samw } 1895331Samw #endif 1905331Samw 1915331Samw #endif /* _SMB_PRIVILEGE_H */ 192