diff options
| author | Gordon Ross <gwr@racktopsystems.com> | 2022-01-18 09:38:37 -0500 |
|---|---|---|
| committer | Toomas Soome <tsoome@me.com> | 2022-11-09 19:40:26 +0200 |
| commit | 814e0daa42b0648d115fbe8c5d2858e4eb099cbd (patch) | |
| tree | 1de4eca49eae3d6655a19af82909f18edd44db04 /usr/src/uts/common | |
| parent | 0d5d3873da6f8c195c095c01db06e31cedc0aa5a (diff) | |
| download | illumos-joyent-814e0daa42b0648d115fbe8c5d2858e4eb099cbd.tar.gz | |
15108 SMB option to enable short names
Reviewed by: Andy Stormont <astormont@racktopsystems.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Matt Barden <mbarden@tintri.com>
Reviewed by: Yuri Pankov <yuri@aetern.org>
Approved by: Dan McDonald <danmcd@mnx.io>
Diffstat (limited to 'usr/src/uts/common')
| -rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb2_tree_connect.c | 1 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb_init.c | 2 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb_kshare.c | 11 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb_server.c | 1 | ||||
| -rw-r--r-- | usr/src/uts/common/fs/smbsrv/smb_tree.c | 21 | ||||
| -rw-r--r-- | usr/src/uts/common/smbsrv/smb_ioctl.h | 3 | ||||
| -rw-r--r-- | usr/src/uts/common/smbsrv/smbinfo.h | 3 |
7 files changed, 26 insertions, 16 deletions
diff --git a/usr/src/uts/common/fs/smbsrv/smb2_tree_connect.c b/usr/src/uts/common/fs/smbsrv/smb2_tree_connect.c index c783d2b19e..a371f90e8d 100644 --- a/usr/src/uts/common/fs/smbsrv/smb2_tree_connect.c +++ b/usr/src/uts/common/fs/smbsrv/smb2_tree_connect.c @@ -127,6 +127,7 @@ errout: /* * XXX These need work.. + * See SMB1 flags in tcon->optional_support */ if (tree->t_encrypt != SMB_CONFIG_DISABLED) ShareFlags = SMB2_SHAREFLAG_ENCRYPT_DATA; diff --git a/usr/src/uts/common/fs/smbsrv/smb_init.c b/usr/src/uts/common/fs/smbsrv/smb_init.c index f7e1739367..9f8d1130f0 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_init.c +++ b/usr/src/uts/common/fs/smbsrv/smb_init.c @@ -22,6 +22,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. * Copyright 2019 Joyent, Inc. + * Copyright 2022 RackTop Systems, Inc. */ #include <sys/types.h> @@ -67,7 +68,6 @@ int smb_maxbufsize = SMB_NT_MAXBUF; int smb_flush_required = 1; int smb_dirsymlink_enable = 1; int smb_sign_debug = 0; -int smb_shortnames = 1; uint_t smb_audit_flags = #ifdef DEBUG SMB_AUDIT_NODE; diff --git a/usr/src/uts/common/fs/smbsrv/smb_kshare.c b/usr/src/uts/common/fs/smbsrv/smb_kshare.c index 0bdd85ddba..01d382fed7 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_kshare.c +++ b/usr/src/uts/common/fs/smbsrv/smb_kshare.c @@ -23,6 +23,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. All rights reserved. * Copyright 2017 Joyent, Inc. + * Copyright 2022 RackTop Systems. */ #include <smbsrv/smb_door.h> @@ -508,8 +509,14 @@ out: int smb_kshare_info(smb_ioc_shareinfo_t *ioc) { - ioc->shortnames = smb_shortnames; - return (0); + smb_server_t *sv; + int rc; + + if ((rc = smb_server_lookup(&sv)) == 0) { + ioc->shortnames = sv->sv_cfg.skc_short_names; + smb_server_release(sv); + } + return (rc); } /* diff --git a/usr/src/uts/common/fs/smbsrv/smb_server.c b/usr/src/uts/common/fs/smbsrv/smb_server.c index 63ca6343bc..ca2d584498 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_server.c +++ b/usr/src/uts/common/fs/smbsrv/smb_server.c @@ -2123,6 +2123,7 @@ smb_server_store_cfg(smb_server_t *sv, smb_ioc_cfg_t *ioc) sv->sv_cfg.skc_ipv6_enable = ioc->ipv6_enable; sv->sv_cfg.skc_print_enable = ioc->print_enable; sv->sv_cfg.skc_traverse_mounts = ioc->traverse_mounts; + sv->sv_cfg.skc_short_names = ioc->short_names; sv->sv_cfg.skc_max_protocol = ioc->max_protocol; sv->sv_cfg.skc_min_protocol = ioc->min_protocol; sv->sv_cfg.skc_encrypt = ioc->encrypt; diff --git a/usr/src/uts/common/fs/smbsrv/smb_tree.c b/usr/src/uts/common/fs/smbsrv/smb_tree.c index 2aadc3bf38..b0f2d9b222 100644 --- a/usr/src/uts/common/fs/smbsrv/smb_tree.c +++ b/usr/src/uts/common/fs/smbsrv/smb_tree.c @@ -22,7 +22,7 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016 by Delphix. All rights reserved. - * Copyright 2021 Tintri by DDN, Inc. All rights reserved. + * Copyright 2022 Tintri by DDN, Inc. All rights reserved. */ /* @@ -743,15 +743,14 @@ smb_tree_connect_disk(smb_request_t *sr, smb_arg_tcon_t *tcon) if (si->shr_flags & SMB_SHRF_DFSROOT) tcon->optional_support |= SMB_SHARE_IS_IN_DFS; - /* if 'smb' zfs property: shortnames=disabled */ - if (!smb_shortnames) - sr->arg.tcon.optional_support |= SMB_UNIQUE_FILE_NAME; - tree = smb_tree_alloc(sr, si, snode, access, sr->sr_cfg->skc_execflags); if (tree == NULL) return (NT_STATUS_INSUFF_SERVER_RESOURCES); + if (tree->t_flags & SMB_TREE_SHORTNAMES) + tcon->optional_support |= SMB_UNIQUE_FILE_NAME; + if (tree->t_execflags & SMB_EXEC_MAP) { smb_tree_set_execinfo(tree, &execinfo, SMB_EXEC_MAP); @@ -1097,6 +1096,7 @@ smb_tree_get_sharename(char *unc_path) /* * Obtain the tree attributes: volume name, typename and flags. + * Called only with DISK and PRINTQ shares. */ static int smb_tree_getattr(const smb_kshare_t *si, smb_node_t *node, smb_tree_t *tree) @@ -1187,6 +1187,9 @@ smb_tree_get_volname(vfs_t *vfsp, smb_tree_t *tree) } /* + * Get flags from the VFS (and other places) for a new tree. + * Called only with DISK and PRINTQ shares. + * * Always set "unicode on disk" because we always use utf8 names locally. * Always set ACL support because the VFS will fake ACLs for file systems * that don't support them. @@ -1238,17 +1241,13 @@ smb_tree_get_flags(const smb_kshare_t *si, vfs_t *vfsp, smb_tree_t *tree) if (si->shr_flags & SMB_SHRF_FSO) flags |= SMB_TREE_FORCE_L2_OPLOCK; - if (ssn->s_cfg.skc_oplock_enable) { - /* if 'smb' zfs property: oplocks=enabled */ + if (ssn->s_cfg.skc_oplock_enable) flags |= SMB_TREE_OPLOCKS; - } - /* Global config option for now. Later make per-share. */ if (ssn->s_cfg.skc_traverse_mounts) flags |= SMB_TREE_TRAVERSE_MOUNTS; - /* if 'smb' zfs property: shortnames=enabled */ - if (smb_shortnames) + if (ssn->s_cfg.skc_short_names) flags |= SMB_TREE_SHORTNAMES; if (vfsp->vfs_flag & VFS_RDONLY) diff --git a/usr/src/uts/common/smbsrv/smb_ioctl.h b/usr/src/uts/common/smbsrv/smb_ioctl.h index fcd912a744..3144c36d03 100644 --- a/usr/src/uts/common/smbsrv/smb_ioctl.h +++ b/usr/src/uts/common/smbsrv/smb_ioctl.h @@ -22,7 +22,7 @@ * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. All rights reserved. * Copyright 2017 Joyent, Inc. - * Copyright 2020 RackTop Systems, Inc. + * Copyright 2022 RackTop Systems, Inc. */ #ifndef _SMB_IOCTL_H_ @@ -172,6 +172,7 @@ typedef struct smb_ioc_cfg { int32_t ipv6_enable; int32_t print_enable; int32_t traverse_mounts; + int32_t short_names; uint32_t max_protocol; uint32_t min_protocol; uint32_t encrypt; diff --git a/usr/src/uts/common/smbsrv/smbinfo.h b/usr/src/uts/common/smbsrv/smbinfo.h index e83d871bff..bb42925757 100644 --- a/usr/src/uts/common/smbsrv/smbinfo.h +++ b/usr/src/uts/common/smbsrv/smbinfo.h @@ -21,7 +21,7 @@ /* * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2020 Tintri by DDN, Inc. All rights reserved. - * Copyright 2021 RackTop Systems, Inc. + * Copyright 2022 RackTop Systems, Inc. */ #ifndef _SMBSRV_SMBINFO_H @@ -158,6 +158,7 @@ typedef struct smb_kmod_cfg { int32_t skc_ipv6_enable; int32_t skc_print_enable; int32_t skc_traverse_mounts; + int32_t skc_short_names; uint32_t skc_max_protocol; /* SMB_VERS_... */ uint32_t skc_min_protocol; /* SMB_VERS_... */ smb_cfg_val_t skc_encrypt; /* EncryptData and RejectUnencryptedAccess */ |
