summaryrefslogtreecommitdiff
path: root/usr/src/common
diff options
context:
space:
mode:
authorGordon Ross <gwr@nexenta.com>2017-08-12 10:54:18 -0400
committerGordon Ross <gwr@nexenta.com>2019-03-14 10:38:30 -0400
commit8329232e00f1048795bae53acb230316243aadb5 (patch)
tree0d9a71c0dd22bd5288debd1dcc2cd3f0e7131d67 /usr/src/common
parentebee07ff4f102cbd3179db7c5070283da35a79f3 (diff)
downloadillumos-joyent-8329232e00f1048795bae53acb230316243aadb5.tar.gz
9874 Add fksmbcl development tool
Reviewed by: Evan Layton <evan.layton@nexenta.com> Reviewed by: Matt Barden <matt.barden@nexenta.com> Approved by: Joshua M. Clulow <josh@sysmgr.org>
Diffstat (limited to 'usr/src/common')
-rw-r--r--usr/src/common/smbclnt/smbfs_ntacl.c29
-rw-r--r--usr/src/common/smbclnt/smbfs_ntacl.h6
2 files changed, 20 insertions, 15 deletions
diff --git a/usr/src/common/smbclnt/smbfs_ntacl.c b/usr/src/common/smbclnt/smbfs_ntacl.c
index dcc0d55e79..3ff10aba82 100644
--- a/usr/src/common/smbclnt/smbfs_ntacl.c
+++ b/usr/src/common/smbclnt/smbfs_ntacl.c
@@ -21,6 +21,7 @@
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
*/
/*
@@ -33,7 +34,7 @@
#include <sys/acl.h>
#include <sys/byteorder.h>
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_FAKE_KERNEL)
#include <sys/cred.h>
#include <sys/cmn_err.h>
@@ -42,16 +43,18 @@
#include <sys/vnode.h>
#include <sys/vfs.h>
-#include <sys/kidmap.h>
-
-#else /* _KERNEL */
+#else /* _KERNEL || _FAKE_KERNEL */
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
-#include <idmap.h>
+#endif /* _KERNEL || _FAKE_KERNEL */
+#ifdef _KERNEL
+#include <sys/kidmap.h>
+#else /* _KERNEL */
+#include <idmap.h>
#endif /* _KERNEL */
#include <netsmb/mchain.h>
@@ -61,7 +64,7 @@
#define NT_SD_REVISION 1
#define NT_ACL_REVISION 2
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_FAKE_KERNEL)
#define MALLOC(size) kmem_alloc(size, KM_SLEEP)
#define FREESZ(p, sz) kmem_free(p, sz)
#else /* _KERNEL */
@@ -887,7 +890,7 @@ ntace2zace(ace_t *zacep, i_ntace_t *ntace, struct mapinfo2uid *mip)
int
smbfs_acl_sd2zfs(
i_ntsd_t *sd,
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_FAKE_KERNEL)
vsecattr_t *acl_info,
#else /* _KERNEL */
acl_t *acl_info,
@@ -908,12 +911,12 @@ smbfs_acl_sd2zfs(
* sanity checks
*/
if (acl_info) {
-#ifndef _KERNEL
+#if !defined(_KERNEL) && !defined(_FAKE_KERNEL)
if (acl_info->acl_type != ACE_T ||
acl_info->acl_aclp != NULL ||
acl_info->acl_entry_size != sizeof (ace_t))
return (EINVAL);
-#endif /* _KERNEL */
+#endif /* !_KERNEL */
if ((sd->sd_flags & SD_DACL_PRESENT) == 0)
return (EINVAL);
}
@@ -1117,7 +1120,7 @@ smbfs_acl_sd2zfs(
zacep->a_type = ACCESS_ALLOWED_ACE_TYPE;
}
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_FAKE_KERNEL)
acl_info->vsa_aclcnt = zacecnt;
acl_info->vsa_aclentp = zacep0;
acl_info->vsa_aclentsz = zacl_size;
@@ -1226,7 +1229,7 @@ smbfs_str2sid(const char *sid_prefix, uint32_t *ridp, i_ntsid_t **osidp)
goto out;
}
p++;
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_FAKE_KERNEL)
err = ddi_strtoul(p, &np, 10, &sa);
if (err != 0)
goto out;
@@ -1409,7 +1412,7 @@ zace2ntace(i_ntace_t **ntacep, ace_t *zacep, struct mapinfo2sid *mip)
*/
int
smbfs_acl_zfs2sd(
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_FAKE_KERNEL)
vsecattr_t *acl_info,
#else /* _KERNEL */
acl_t *acl_info,
@@ -1455,7 +1458,7 @@ smbfs_acl_zfs2sd(
return (EINVAL);
if (own_gid == (gid_t)-1)
return (EINVAL);
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_FAKE_KERNEL)
if ((acl_info->vsa_mask & VSA_ACE) == 0)
return (EINVAL);
zacecnt = acl_info->vsa_aclcnt;
diff --git a/usr/src/common/smbclnt/smbfs_ntacl.h b/usr/src/common/smbclnt/smbfs_ntacl.h
index d3ef999f58..830282cf44 100644
--- a/usr/src/common/smbclnt/smbfs_ntacl.h
+++ b/usr/src/common/smbclnt/smbfs_ntacl.h
@@ -22,6 +22,8 @@
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _SMBFS_NTACL_H
@@ -122,7 +124,7 @@ int mb_put_ntsd(mbchain_t *mbp, i_ntsd_t *sd);
* Convert an internal SD to a ZFS-style ACL.
* Get uid/gid too if pointers != NULL.
*/
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_FAKE_KERNEL)
int smbfs_acl_sd2zfs(i_ntsd_t *, vsecattr_t *, uid_t *, gid_t *);
#else /* _KERNEL */
/* See also: lib/libsmbfs/netsmb/smbfs_acl.h */
@@ -136,7 +138,7 @@ int smbfs_acl_sd2zfs(struct i_ntsd *, acl_t *, uid_t *, gid_t *);
* (when setting them) or existing, so that any
* owner@ or group@ ACEs can be translated.
*/
-#ifdef _KERNEL
+#if defined(_KERNEL) || defined(_FAKE_KERNEL)
int smbfs_acl_zfs2sd(vsecattr_t *, uid_t, gid_t, uint32_t, i_ntsd_t **);
#else /* _KERNEL */
/* See also: lib/libsmbfs/netsmb/smbfs_acl.h */