17568150aSgwr /* 27568150aSgwr * CDDL HEADER START 37568150aSgwr * 47568150aSgwr * The contents of this file are subject to the terms of the 57568150aSgwr * Common Development and Distribution License (the "License"). 67568150aSgwr * You may not use this file except in compliance with the License. 77568150aSgwr * 87568150aSgwr * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97568150aSgwr * or http://www.opensolaris.org/os/licensing. 107568150aSgwr * See the License for the specific language governing permissions 117568150aSgwr * and limitations under the License. 127568150aSgwr * 137568150aSgwr * When distributing Covered Code, include this CDDL HEADER in each 147568150aSgwr * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157568150aSgwr * If applicable, add the following below this CDDL HEADER, with the 167568150aSgwr * fields enclosed by brackets "[]" replaced with your own identifying 177568150aSgwr * information: Portions Copyright [yyyy] [name of copyright owner] 187568150aSgwr * 197568150aSgwr * CDDL HEADER END 207568150aSgwr */ 217568150aSgwr 227568150aSgwr /* 23*bd7c6f51SGordon Ross * Copyright 2010 Sun Microsystems, Inc. All rights reserved. 247568150aSgwr * Use is subject to license terms. 257568150aSgwr */ 267568150aSgwr 277568150aSgwr #ifndef _NETSMB_SMBFS_ACL_H 287568150aSgwr #define _NETSMB_SMBFS_ACL_H 297568150aSgwr 307568150aSgwr /* 317568150aSgwr * Get/set ACL via contracted interface in libsmbfs. 327568150aSgwr * The ACL is in the form used by libsec (type=ACE_T) 337568150aSgwr * but we need to carry the uid/gid info here too. 347568150aSgwr */ 357568150aSgwr 367568150aSgwr #include <sys/acl.h> 377568150aSgwr 38613a2f6bSGordon Ross #ifdef __cplusplus 39613a2f6bSGordon Ross extern "C" { 40613a2f6bSGordon Ross #endif 41613a2f6bSGordon Ross 427568150aSgwr /* 437568150aSgwr * Get a ZFS-style acl from an FD opened in smbfs. 447568150aSgwr * Intentionally similar to: facl_get(3SEC) 457568150aSgwr * 467568150aSgwr * Allocates an acl_t via libsec. Free with: acl_free(3SEC) 477568150aSgwr * Get owner/group IDs too if ID pointers != NULL 487568150aSgwr */ 497568150aSgwr int smbfs_acl_get(int fd, acl_t **, uid_t *, gid_t *); 507568150aSgwr 517568150aSgwr /* 527568150aSgwr * Set a ZFS-style acl onto an FD opened in smbfs. 537568150aSgwr * Intentionally similar to: facl_set(3SEC) 547568150aSgwr * 557568150aSgwr * The acl_t must be of type ACE_T (from libsec). 567568150aSgwr * Set owner/group IDs too if ID values != -1 577568150aSgwr */ 587568150aSgwr int smbfs_acl_set(int fd, acl_t *, uid_t, gid_t); 597568150aSgwr 607568150aSgwr 617568150aSgwr /* 627568150aSgwr * Slightly lower-level functions, allowing access to 637568150aSgwr * the raw Windows Security Descriptor (SD) 6402d09e03SGordon Ross * 6502d09e03SGordon Ross * The struct i_ntsid is opaque in this I/F. 6602d09e03SGordon Ross * Real decl. in: common/smbclnt/smbfs_ntacl.h 677568150aSgwr */ 6802d09e03SGordon Ross struct i_ntsd; 697568150aSgwr 707568150aSgwr /* 717568150aSgwr * Get an "internal form" SD from the FD (opened in smbfs). 727568150aSgwr * Allocates a hierarchy in isdp. Caller must free it via 737568150aSgwr * smbfs_acl_free_isd() 747568150aSgwr */ 7502d09e03SGordon Ross int smbfs_acl_getsd(int fd, uint32_t, struct i_ntsd **); 767568150aSgwr 777568150aSgwr /* 787568150aSgwr * Set an "internal form" SD onto the FD (opened in smbfs). 797568150aSgwr */ 8002d09e03SGordon Ross int smbfs_acl_setsd(int fd, uint32_t, struct i_ntsd *); 81613a2f6bSGordon Ross 82*bd7c6f51SGordon Ross /* 83*bd7c6f51SGordon Ross * Selector bits (2nd arg above) copied from smb.h so we 84*bd7c6f51SGordon Ross * don't need that whole thing exposed to our consumers. 85*bd7c6f51SGordon Ross * Any mismatch would be detected in smb/acl_api.c 86*bd7c6f51SGordon Ross */ 87*bd7c6f51SGordon Ross #define OWNER_SECURITY_INFORMATION 0x00000001 88*bd7c6f51SGordon Ross #define GROUP_SECURITY_INFORMATION 0x00000002 89*bd7c6f51SGordon Ross #define DACL_SECURITY_INFORMATION 0x00000004 90*bd7c6f51SGordon Ross #define SACL_SECURITY_INFORMATION 0x00000008 91*bd7c6f51SGordon Ross 92613a2f6bSGordon Ross struct __FILE; 9302d09e03SGordon Ross void smbfs_acl_print_sd(struct __FILE *, struct i_ntsd *); 94613a2f6bSGordon Ross 95*bd7c6f51SGordon Ross /* 96*bd7c6f51SGordon Ross * These are duplicated from common/smbclnt/smbfs_ntacl.h 97*bd7c6f51SGordon Ross * rather than exporting that header for this library. 98*bd7c6f51SGordon Ross * Any mismatch would be detected in smb/acl_api.c 99*bd7c6f51SGordon Ross */ 100*bd7c6f51SGordon Ross int smbfs_acl_sd2zfs(struct i_ntsd *, acl_t *, uid_t *, gid_t *); 101*bd7c6f51SGordon Ross int smbfs_acl_zfs2sd(acl_t *, uid_t, gid_t, uint32_t, struct i_ntsd **); 102*bd7c6f51SGordon Ross void smbfs_acl_free_sd(struct i_ntsd *); 103*bd7c6f51SGordon Ross 104613a2f6bSGordon Ross #ifdef __cplusplus 105613a2f6bSGordon Ross } 106613a2f6bSGordon Ross #endif 1077568150aSgwr 1087568150aSgwr #endif /* _NETSMB_SMBFS_ACL_H */ 109