smbfs_acl.h revision 11332:ed3411181494
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#ifndef _NETSMB_SMBFS_ACL_H
28#define	_NETSMB_SMBFS_ACL_H
29
30/*
31 * Get/set ACL via contracted interface in libsmbfs.
32 * The ACL is in the form used by libsec (type=ACE_T)
33 * but we need to carry the uid/gid info here too.
34 */
35
36#include <sys/acl.h>
37
38#ifdef	__cplusplus
39extern "C" {
40#endif
41
42/*
43 * Get a ZFS-style acl from an FD opened in smbfs.
44 * Intentionally similar to: facl_get(3SEC)
45 *
46 * Allocates an acl_t via libsec.  Free with: acl_free(3SEC)
47 * Get owner/group IDs too if ID pointers != NULL
48 */
49int smbfs_acl_get(int fd, acl_t **, uid_t *, gid_t *);
50
51/*
52 * Set a ZFS-style acl onto an FD opened in smbfs.
53 * Intentionally similar to: facl_set(3SEC)
54 *
55 * The acl_t must be of type ACE_T (from libsec).
56 * Set owner/group IDs too if ID values != -1
57 */
58int smbfs_acl_set(int fd, acl_t *, uid_t, gid_t);
59
60
61/*
62 * Slightly lower-level functions, allowing access to
63 * the raw Windows Security Descriptor (SD)
64 *
65 * The struct i_ntsid is opaque in this I/F.
66 * Real decl. in: common/smbclnt/smbfs_ntacl.h
67 */
68struct i_ntsd;
69
70/*
71 * Get an "internal form" SD from the FD (opened in smbfs).
72 * Allocates a hierarchy in isdp.  Caller must free it via
73 * smbfs_acl_free_isd()
74 */
75int smbfs_acl_getsd(int fd, uint32_t, struct i_ntsd **);
76
77/*
78 * Set an "internal form" SD onto the FD (opened in smbfs).
79 */
80int smbfs_acl_setsd(int fd, uint32_t, struct i_ntsd *);
81
82struct __FILE;
83void smbfs_acl_print_sd(struct __FILE *, struct i_ntsd *);
84
85#ifdef	__cplusplus
86}
87#endif
88
89#endif	/* _NETSMB_SMBFS_ACL_H */
90