summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/fs/smbsrv/smb_kshare.c
diff options
context:
space:
mode:
authorAlan Wright <amw@Sun.COM>2009-06-09 14:20:02 -0600
committerAlan Wright <amw@Sun.COM>2009-06-09 14:20:02 -0600
commit29bd28862cfb8abbd3a0f0a4b17e08bbc3652836 (patch)
treeea421b218a8132c096d7513e63e8174869463a72 /usr/src/uts/common/fs/smbsrv/smb_kshare.c
parent08045defdf65ee890fef6e20510a093a17feb8fe (diff)
downloadillumos-gate-29bd28862cfb8abbd3a0f0a4b17e08bbc3652836.tar.gz
6803042 AUXILIARY tags in libsmb mapfile produce ELF noise and bloated binary
6663517 smb_auth_[nt]lm_hash and friends should take const arguments 6788664 Remove misleading debug messages at smbd startup 6828536 Allow manipulating ACLs on share from Windows client 6836556 smb_nic_addhost miscomputes buffer length 6766364 Add scripting support to Autohome PSARC 2009/184 SMB/CIFS Share Exec Properties 6837681 CIFS server ignores the preferred DC setting during DC discovery 6775827 cifs server should support guest access PSARC 2009/164 Support for guest access to CIFS/SMB shares 6744962 The daemon smbd doesn't go into maintenance state when the listeners cannot bind to the sockets. 6810419 For smb server on SPARC, NetBIOS name IP is backwards for Windows machine 6840864 Additional levels for srvsvc netshareinfo 6813129 Unable to map cifs share using fqdn and <userPrincipalName>@fqdn for authentication. 6742726 panic when trying to join domain with 1000 pre-existing shares 6842449 The ADS selection algorithm doesn't always pick the configured 'pdc'. 6840692 Setting pdc configuration requires smb/server restart 6832673 smb_ads_find_host() can return host from incorrect domain when host is cached 6840721 Unable to assign an IPv6 address to the 'pdc' property 6842462 FW needs an API for finding a domain controller in a multiple DC environment 6843140 CIFS service dumps core when security tab accessed with certain ACE combinations
Diffstat (limited to 'usr/src/uts/common/fs/smbsrv/smb_kshare.c')
-rw-r--r--usr/src/uts/common/fs/smbsrv/smb_kshare.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/usr/src/uts/common/fs/smbsrv/smb_kshare.c b/usr/src/uts/common/fs/smbsrv/smb_kshare.c
index 50a921ecbc..f1a480b59f 100644
--- a/usr/src/uts/common/fs/smbsrv/smb_kshare.c
+++ b/usr/src/uts/common/fs/smbsrv/smb_kshare.c
@@ -178,6 +178,73 @@ smb_kshare_enum(door_handle_t dhdl, smb_enumshare_info_t *enuminfo)
}
/*
+ * Executes map and unmap command for shares.
+ */
+uint32_t
+smb_kshare_exec(door_handle_t dhdl, char *sharename, smb_execsub_info_t *subs,
+ int exec_type)
+{
+ door_arg_t arg;
+ char *buf;
+ int bufsz;
+ unsigned int used;
+ smb_dr_ctx_t *dec_ctx;
+ smb_dr_ctx_t *enc_ctx;
+ uint32_t rc;
+ int opcode = SMB_SHROP_EXEC;
+
+ bufsz = (2 * sizeof (int)) + strlen(sharename) + strlen(subs->e_winname)
+ + strlen(subs->e_userdom) + strlen(subs->e_cli_netbiosname) +
+ (2 * sizeof (smb_inaddr_t)) + sizeof (uid_t) +
+ sizeof (smb_execsub_info_t);
+
+ buf = kmem_alloc(bufsz, KM_SLEEP);
+
+ enc_ctx = smb_dr_encode_start(buf, bufsz);
+ smb_dr_put_uint32(enc_ctx, opcode);
+ smb_dr_put_string(enc_ctx, sharename);
+ smb_dr_put_string(enc_ctx, subs->e_winname);
+ smb_dr_put_string(enc_ctx, subs->e_userdom);
+ smb_dr_put_buf(enc_ctx, (uchar_t *)&subs->e_srv_ipaddr,
+ sizeof (smb_inaddr_t));
+ smb_dr_put_buf(enc_ctx, (uchar_t *)&subs->e_cli_ipaddr,
+ sizeof (smb_inaddr_t));
+ smb_dr_put_string(enc_ctx, subs->e_cli_netbiosname);
+ smb_dr_put_int32(enc_ctx, subs->e_uid);
+ smb_dr_put_int32(enc_ctx, exec_type);
+
+ if (smb_dr_encode_finish(enc_ctx, &used) != 0) {
+ kmem_free(buf, bufsz);
+ return (NERR_InternalError);
+ }
+
+ arg.data_ptr = buf;
+ arg.data_size = used;
+ arg.desc_ptr = NULL;
+ arg.desc_num = 0;
+ arg.rbuf = buf;
+ arg.rsize = bufsz;
+
+ if (door_ki_upcall_limited(dhdl, &arg, NULL, SIZE_MAX, 0) != 0) {
+ kmem_free(buf, bufsz);
+ return (NERR_InternalError);
+ }
+
+ dec_ctx = smb_dr_decode_start(arg.data_ptr, arg.data_size);
+ if (smb_kshare_chk_dsrv_status(opcode, dec_ctx) != 0) {
+ kmem_free(buf, bufsz);
+ return (NERR_InternalError);
+ }
+
+ rc = smb_dr_get_uint32(dec_ctx);
+ if (smb_dr_decode_finish(dec_ctx) != 0)
+ rc = NERR_InternalError;
+
+ kmem_free(buf, bufsz);
+ return (rc);
+}
+
+/*
* This is a special interface that will be utilized by ZFS to cause
* a share to be added/removed
*