Mercurial > illumos > illumos-gate
changeset 6161:abae99e8e7ed
6671582 Unreferenced files need to be removed.
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deleted_files/usr/src/cmd/smbsrv/smbd/smbd_door_server.c Wed Mar 05 21:59:55 2008 -0800 @@ -0,0 +1,278 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * SMBd door server + */ + +#include <door.h> +#include <errno.h> +#include <syslog.h> +#include <unistd.h> +#include <stdio.h> +#include <synch.h> +#include <string.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <pthread.h> +#include <syslog.h> +#include <assert.h> +#include <alloca.h> + +#include <smbsrv/libsmb.h> +#include <smbsrv/libsmbns.h> +#include <smbsrv/libsmbrdr.h> + +#include <smbsrv/smb_common_door.h> + +static int smb_door_fildes = -1; +static mutex_t smb_doorsrv_mutex; + +void smb_srv_door(void *, char *, size_t, door_desc_t *, uint_t); + +extern uint32_t smbd_join(smb_joininfo_t *); + +/* + * smb_doorsrv_start + * + * Start the SMBd door service. + * Returns 0 on success. Otherwise, -1. + */ +int +smb_doorsrv_start() +{ + int newfd; + + (void) mutex_lock(&smb_doorsrv_mutex); + + if (smb_door_fildes != -1) { + syslog(LOG_ERR, "smb_doorsrv_start: duplicate"); + (void) mutex_unlock(&smb_doorsrv_mutex); + return (0); + } + + if ((smb_door_fildes = door_create(smb_srv_door, + SMBD_DOOR_COOKIE, DOOR_UNREF)) < 0) { + syslog(LOG_ERR, "smb_doorsrv_start: door_create failed %s", + strerror(errno)); + (void) mutex_unlock(&smb_doorsrv_mutex); + return (-1); + } + + (void) unlink(SMBD_DOOR_NAME); + + if ((newfd = creat(SMBD_DOOR_NAME, 0644)) < 0) { + syslog(LOG_ERR, "smb_doorsrv_start: open failed %s", + strerror(errno)); + (void) door_revoke(smb_door_fildes); + smb_door_fildes = -1; + (void) mutex_unlock(&smb_doorsrv_mutex); + return (-1); + } + + (void) close(newfd); + (void) fdetach(SMBD_DOOR_NAME); + + if (fattach(smb_door_fildes, SMBD_DOOR_NAME) < 0) { + syslog(LOG_ERR, "smb_doorsrv_start: fattach failed %s", + strerror(errno)); + (void) door_revoke(smb_door_fildes); + smb_door_fildes = -1; + (void) mutex_unlock(&smb_doorsrv_mutex); + return (-1); + } + + (void) mutex_unlock(&smb_doorsrv_mutex); + return (0); +} + + +/* + * smb_doorsrv_stop + * + * Stop the smbd door service. + */ +void +smb_doorsrv_stop(void) +{ + (void) mutex_lock(&smb_doorsrv_mutex); + + if (smb_door_fildes != -1) { + (void) fdetach(SMBD_DOOR_NAME); + (void) door_revoke(smb_door_fildes); + smb_door_fildes = -1; + } + + (void) mutex_unlock(&smb_doorsrv_mutex); +} + + +/* + * smb_srv_door + * + */ +/*ARGSUSED*/ +void +smb_srv_door(void *cookie, char *ptr, size_t size, door_desc_t *dp, + uint_t n_desc) +{ + int req_type, rc; + char *buf; + int buflen; + unsigned int used; + smb_dr_ctx_t *dec_ctx; + smb_dr_ctx_t *enc_ctx; + unsigned int dec_status; + unsigned int enc_status; + char *domain; + char *user; + char *passwd; + smb_joininfo_t jdi; + + + dec_ctx = smb_dr_decode_start(ptr, size); + + if (dec_ctx == 0) + return; + + req_type = smb_dr_get_uint32(dec_ctx); + buflen = SMBD_DOOR_SIZE; + + if ((buf = alloca(buflen)) == NULL) { + syslog(LOG_ERR, "SmbdDoorSrv: resource shortage"); + (void) smb_dr_decode_finish(dec_ctx); + return; + } + + enc_ctx = smb_dr_encode_start(buf, buflen); + if (enc_ctx == 0) { + syslog(LOG_ERR, "SmbdDoorSrv: encode start failed"); + (void) smb_dr_decode_finish(dec_ctx); + return; + } + + switch (req_type) { + case SMBD_DOOR_PARAM_GET: { + smb_cfg_id_t id; + char value[MAX_VALUE_BUFLEN]; + + id = smb_dr_get_uint32(dec_ctx); + + dec_status = smb_dr_decode_finish(dec_ctx); + if (dec_status != 0) + goto decode_error; + + (void) smb_config_getstr(id, value, sizeof (value)); + smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_SUCCESS); + smb_dr_put_string(enc_ctx, value); + break; + } + + case SMBD_DOOR_PARAM_SET: { + smb_cfg_id_t id; + char *value = NULL; + + id = smb_dr_get_uint32(dec_ctx); + value = smb_dr_get_string(dec_ctx); + + dec_status = smb_dr_decode_finish(dec_ctx); + if (dec_status != 0) { + smb_dr_free_string(value); + goto decode_error; + } + + if (smb_config_setstr(id, value) == SMBD_SMF_OK) + smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_SUCCESS); + else + smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_ERROR); + smb_dr_free_string(value); + break; + } + + case SMBD_DOOR_NETBIOS_RECONFIG: { + smb_netbios_name_reconfig(); + smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_SUCCESS); + break; + } + + case SMBD_DOOR_JOIN: + jdi.mode = smb_dr_get_uint32(dec_ctx); + domain = smb_dr_get_string(dec_ctx); + user = smb_dr_get_string(dec_ctx); + passwd = smb_dr_get_string(dec_ctx); + + dec_status = smb_dr_decode_finish(dec_ctx); + if (dec_status != 0 || + domain == 0 || user == 0 || passwd == 0) { + smb_dr_free_string(domain); + smb_dr_free_string(user); + smb_dr_free_string(passwd); + goto decode_error; + } + + (void) strlcpy(jdi.domain_name, domain, + sizeof (jdi.domain_name)); + (void) strlcpy(jdi.domain_username, user, + sizeof (jdi.domain_username)); + (void) strlcpy(jdi.domain_passwd, passwd, + sizeof (jdi.domain_passwd)); + + smb_dr_free_string(domain); + smb_dr_free_string(user); + smb_dr_free_string(passwd); + + rc = smbd_join(&jdi); + smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_SUCCESS); + smb_dr_put_int32(enc_ctx, rc); + break; + + default: + goto decode_error; + } + + if ((enc_status = smb_dr_encode_finish(enc_ctx, &used)) != 0) + goto encode_error; + + (void) door_return(buf, used, NULL, 0); + + return; + +decode_error: + (void) smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_ERROR); + (void) smb_dr_put_uint32(enc_ctx, dec_status); + (void) smb_dr_encode_finish(enc_ctx, &used); + (void) door_return(buf, used, NULL, 0); + return; + +encode_error: + enc_ctx = smb_dr_encode_start(buf, buflen); + (void) smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_ERROR); + (void) smb_dr_put_uint32(enc_ctx, enc_status); + (void) smb_dr_encode_finish(enc_ctx, &used); + + (void) door_return(buf, used, NULL, 0); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deleted_files/usr/src/lib/smbsrv/libsmb/common/smb_door_client.c Wed Mar 05 21:59:55 2008 -0800 @@ -0,0 +1,411 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * User-space door client for SMBd + */ + +#include <fcntl.h> +#include <syslog.h> +#include <door.h> +#include <string.h> +#include <strings.h> +#include <stdlib.h> +#include <errno.h> + +#include <smbsrv/smbinfo.h> +#include <smbsrv/wintypes.h> +#include <smbsrv/ntstatus.h> +#include <smbsrv/alloc.h> +#include <smbsrv/smb_common_door.h> + +#include <smbsrv/libsmb.h> + +static int smb_door_fildes = -1; + +static char *smbd_desc[] = { + "", + "SmbdJoinDomain", + "SmbdGetParam", + "SmbdSetParam", + "SmbdNetbiosReconfig", + 0 +}; + +/* + * Returns 0 on success. Otherwise, -1. + */ +static int +smbd_door_open(int opcode) +{ + int rc = 0; + + if (smb_door_fildes == -1 && + (smb_door_fildes = open(SMBD_DOOR_NAME, O_RDONLY)) < 0) { + syslog(LOG_ERR, "%s: open %s failed %s", smbd_desc[opcode], + SMBD_DOOR_NAME, strerror(errno)); + rc = -1; + } + + return (rc); +} + +/* + * Return 0 upon success. Otherwise, -1. + */ +static int +smbd_door_check_srv_status(int opcode, smb_dr_ctx_t *dec_ctx) +{ + int status = smb_dr_get_int32(dec_ctx); + int err; + int rc = -1; + + switch (status) { + case SMBD_DOOR_SRV_SUCCESS: + rc = 0; + break; + + case SMBD_DOOR_SRV_ERROR: + err = smb_dr_get_uint32(dec_ctx); + syslog(LOG_ERR, "%s: Encountered door server error %s", + smbd_desc[opcode], strerror(err)); + break; + + default: + syslog(LOG_ERR, "%s: Unknown door server status", + smbd_desc[opcode]); + } + + if (rc != 0) { + if ((err = smb_dr_decode_finish(dec_ctx)) != 0) { + syslog(LOG_ERR, "%s: Decode error %s", + smbd_desc[opcode], strerror(err)); + } + } + + return (rc); +} + +uint32_t +smb_join(smb_joininfo_t *jdi) +{ + door_arg_t arg; + char *buf; + uint32_t used; + smb_dr_ctx_t *dec_ctx; + smb_dr_ctx_t *enc_ctx; + int status; + uint32_t rc; + int opcode = SMBD_DOOR_JOIN; + + if ((jdi == 0) || (*jdi->domain_name == 0)) { + syslog(LOG_ERR, "%s: invalid parameter(s)", smbd_desc[opcode]); + return (NT_STATUS_INVALID_PARAMETER); + } + + if (smbd_door_open(opcode) == -1) { + syslog(LOG_ERR, "%s: cannot open the door", smbd_desc[opcode]); + return (NT_STATUS_INTERNAL_ERROR); + } + + buf = MEM_MALLOC("smb_door_client", SMBD_DOOR_SIZE); + if (!buf) { + syslog(LOG_ERR, "%s: resource shortage", smbd_desc[opcode]); + return (NT_STATUS_NO_MEMORY); + } + + enc_ctx = smb_dr_encode_start(buf, SMBD_DOOR_SIZE); + if (enc_ctx == 0) { + syslog(LOG_ERR, "%s: encode start failed", smbd_desc[opcode]); + MEM_FREE("smb_door_client", buf); + return (NT_STATUS_INTERNAL_ERROR); + } + + smb_dr_put_uint32(enc_ctx, opcode); + smb_dr_put_uint32(enc_ctx, jdi->mode); + smb_dr_put_string(enc_ctx, jdi->domain_name); + smb_dr_put_string(enc_ctx, jdi->domain_username); + smb_dr_put_string(enc_ctx, jdi->domain_passwd); + + if ((status = smb_dr_encode_finish(enc_ctx, &used)) != 0) { + syslog(LOG_ERR, "%s: Encode error %s", + smbd_desc[opcode], strerror(status)); + MEM_FREE("smb_door_client", buf); + return (NT_STATUS_INTERNAL_ERROR); + } + + arg.data_ptr = buf; + arg.data_size = used; + arg.desc_ptr = NULL; + arg.desc_num = 0; + arg.rbuf = buf; + arg.rsize = SMBD_DOOR_SIZE; + + if (door_call(smb_door_fildes, &arg) < 0) { + syslog(LOG_ERR, "%s: Door call failed %s", smbd_desc[opcode], + strerror(errno)); + MEM_FREE("smb_door_client", buf); + smb_door_fildes = -1; + return (NT_STATUS_INTERNAL_ERROR); + } + + dec_ctx = smb_dr_decode_start(arg.data_ptr, arg.data_size); + if (smbd_door_check_srv_status(opcode, dec_ctx) != 0) { + MEM_FREE("smb_door_client", buf); + return (NT_STATUS_INTERNAL_ERROR); + } + + rc = smb_dr_get_uint32(dec_ctx); + if ((status = smb_dr_decode_finish(dec_ctx)) != 0) { + syslog(LOG_ERR, "%s: Decode error %s", + smbd_desc[opcode], strerror(status)); + MEM_FREE("smb_door_client", buf); + return (NT_STATUS_INTERNAL_ERROR); + } + + MEM_FREE("smb_door_client", buf); + return (rc); +} + +int +smbd_netbios_reconfig() +{ + door_arg_t arg; + char *buf; + uint32_t used; + smb_dr_ctx_t *dec_ctx; + smb_dr_ctx_t *enc_ctx; + int status; + DWORD rc; + int opcode = SMBD_DOOR_NETBIOS_RECONFIG; + + if (smbd_door_open(opcode) == -1) { + syslog(LOG_ERR, "%s: cannot open the door", smbd_desc[opcode]); + return (1); + } + + buf = MEM_MALLOC("smb_door_client", SMBD_DOOR_SIZE); + if (!buf) { + syslog(LOG_ERR, "%s: resource shortage", smbd_desc[opcode]); + return (1); + } + + enc_ctx = smb_dr_encode_start(buf, SMBD_DOOR_SIZE); + if (enc_ctx == 0) { + syslog(LOG_ERR, "%s: encode start failed", smbd_desc[opcode]); + MEM_FREE("smb_door_client", buf); + return (1); + } + + smb_dr_put_uint32(enc_ctx, opcode); + + if ((status = smb_dr_encode_finish(enc_ctx, &used)) != 0) { + syslog(LOG_ERR, "%s: Encode error %s", + smbd_desc[opcode], strerror(status)); + MEM_FREE("smb_door_client", buf); + return (1); + } + + arg.data_ptr = buf; + arg.data_size = used; + arg.desc_ptr = NULL; + arg.desc_num = 0; + arg.rbuf = buf; + arg.rsize = SMBD_DOOR_SIZE; + + if (door_call(smb_door_fildes, &arg) < 0) { + syslog(LOG_ERR, "%s: Door call failed %s", smbd_desc[opcode], + strerror(errno)); + MEM_FREE("smb_door_client", buf); + smb_door_fildes = -1; + return (1); + } + + dec_ctx = smb_dr_decode_start(arg.data_ptr, arg.data_size); + rc = smb_dr_get_uint32(dec_ctx); + + if ((status = smb_dr_decode_finish(dec_ctx)) != 0) { + syslog(LOG_ERR, "%s: Decode error %s", + smbd_desc[opcode], strerror(status)); + MEM_FREE("smb_door_client", buf); + return (1); + } + MEM_FREE("smb_door_client", buf); + return (rc); +} + +int +smbd_set_param(smb_cfg_id_t id, char *value) +{ + door_arg_t arg; + char *buf; + uint32_t used; + smb_dr_ctx_t *dec_ctx; + smb_dr_ctx_t *enc_ctx; + int status; + DWORD rc; + int opcode = SMBD_DOOR_PARAM_SET; + + if (smbd_door_open(opcode) == -1) { + syslog(LOG_ERR, "%s: cannot open the door", smbd_desc[opcode]); + return (1); + } + + buf = MEM_MALLOC("smb_door_client", SMBD_DOOR_SIZE); + if (!buf) { + syslog(LOG_ERR, "%s: resource shortage", smbd_desc[opcode]); + return (1); + } + + enc_ctx = smb_dr_encode_start(buf, SMBD_DOOR_SIZE); + if (enc_ctx == 0) { + syslog(LOG_ERR, "%s: encode start failed", smbd_desc[opcode]); + MEM_FREE("smb_door_client", buf); + return (1); + } + + smb_dr_put_uint32(enc_ctx, opcode); + smb_dr_put_uint32(enc_ctx, id); + smb_dr_put_string(enc_ctx, value); + + if ((status = smb_dr_encode_finish(enc_ctx, &used)) != 0) { + syslog(LOG_ERR, "%s: Encode error %s", + smbd_desc[opcode], strerror(status)); + MEM_FREE("smb_door_client", buf); + return (1); + } + + arg.data_ptr = buf; + arg.data_size = used; + arg.desc_ptr = NULL; + arg.desc_num = 0; + arg.rbuf = buf; + arg.rsize = SMBD_DOOR_SIZE; + + if (door_call(smb_door_fildes, &arg) < 0) { + syslog(LOG_ERR, "%s: Door call failed %s", smbd_desc[opcode], + strerror(errno)); + MEM_FREE("smb_door_client", buf); + smb_door_fildes = -1; + return (1); + } + + dec_ctx = smb_dr_decode_start(arg.data_ptr, arg.data_size); + rc = smb_dr_get_uint32(dec_ctx); + + if ((status = smb_dr_decode_finish(dec_ctx)) != 0) { + syslog(LOG_ERR, "%s: Decode error %s", + smbd_desc[opcode], strerror(status)); + MEM_FREE("smb_door_client", buf); + return (1); + } + MEM_FREE("smb_door_client", buf); + return (rc); +} + +int +smbd_get_param(smb_cfg_id_t id, char *value) +{ + door_arg_t arg; + char *buf; + char *tmp = NULL; + uint32_t used; + smb_dr_ctx_t *dec_ctx; + smb_dr_ctx_t *enc_ctx; + int status; + DWORD rc; + int opcode = SMBD_DOOR_PARAM_GET; + + if (smbd_door_open(opcode) == -1) { + syslog(LOG_ERR, "%s: cannot open the door", smbd_desc[opcode]); + return (1); + } + + buf = MEM_MALLOC("smb_door_client", SMBD_DOOR_SIZE); + if (!buf) { + syslog(LOG_ERR, "%s: resource shortage", smbd_desc[opcode]); + return (1); + } + + enc_ctx = smb_dr_encode_start(buf, SMBD_DOOR_SIZE); + if (enc_ctx == 0) { + syslog(LOG_ERR, "%s: encode start failed", smbd_desc[opcode]); + MEM_FREE("smb_door_client", buf); + return (1); + } + + smb_dr_put_uint32(enc_ctx, opcode); + smb_dr_put_uint32(enc_ctx, id); + + if ((status = smb_dr_encode_finish(enc_ctx, &used)) != 0) { + syslog(LOG_ERR, "%s: Encode error %s", + smbd_desc[opcode], strerror(status)); + MEM_FREE("smb_door_client", buf); + return (1); + } + + arg.data_ptr = buf; + arg.data_size = used; + arg.desc_ptr = NULL; + arg.desc_num = 0; + arg.rbuf = buf; + arg.rsize = SMBD_DOOR_SIZE; + + if (door_call(smb_door_fildes, &arg) < 0) { + syslog(LOG_ERR, "%s: Door call failed %s", smbd_desc[opcode], + strerror(errno)); + MEM_FREE("smb_door_client", buf); + smb_door_fildes = -1; + return (1); + } + + dec_ctx = smb_dr_decode_start(arg.data_ptr, arg.data_size); + rc = smb_dr_get_uint32(dec_ctx); + tmp = smb_dr_get_string(dec_ctx); + (void) strcpy(value, tmp); + + if ((status = smb_dr_decode_finish(dec_ctx)) != 0) { + syslog(LOG_ERR, "%s: Decode error %s", + smbd_desc[opcode], strerror(status)); + MEM_FREE("smb_door_client", buf); + return (1); + } + MEM_FREE("smb_door_client", buf); + return (rc); +} + +int +smbd_get_security_mode(int *mode) +{ + char buf[64]; + int rc; + + buf[0] = '\0'; + rc = smbd_get_param(SMB_CI_SECURITY, buf); + *mode = smb_config_secmode_fromstr(buf); + return (rc); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deleted_files/usr/src/uts/common/fs/smbsrv/smb_copy.c Wed Mar 05 21:59:55 2008 -0800 @@ -0,0 +1,121 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * SMB: copy_file + * + * Client Request Description + * ================================== ================================= + * + * UCHAR WordCount; Count of parameter words = 3 + * USHORT Tid2; Second (target) path TID + * USHORT OpenFunction; What to do if target file exists + * USHORT Flags; Flags to control copy operation: + * bit 0 - target must be a file + * bit 1 - target must be a dir. + * bit 2 - copy target mode: + * 0 = binary, 1 = ASCII + * bit 3 - copy source mode: + * 0 = binary, 1 = ASCII + * bit 4 - verify all writes + * bit 5 - tree copy + * USHORT ByteCount; Count of data bytes; min = 2 + * UCHAR SourceFileNameFormat; 0x04 + * STRING SourceFileName; Pathname of source file + * UCHAR TargetFileNameFormat; 0x04 + * STRING TargetFileName; Pathname of target file + * + * The file at SourceName is copied to TargetFileName, both of which must refer + * to paths on the same server. + * + * The Tid in the header is associated with the source while Tid2 is + * associated with the destination. These fields may contain the same or + * differing valid values. Tid2 can be set to -1 indicating that this is to + * be the same Tid as in the SMB header. This allows use of the move + * protocol with SMB_TREE_CONNECT_ANDX. + * + * Server Response Description + * ================================== ================================= + * + * UCHAR WordCount; Count of parameter words = 1 + * USHORT Count; Number of files copied + * USHORT ByteCount; Count of data bytes; min = 0 + * UCHAR ErrorFileFormat; 0x04 (only if error) + * STRING ErrorFileName; + * + * The source path must refer to an existing file or files. Wildcards are + * permitted. Source files specified by wildcards are processed until an + * error is encountered. If an error is encountered, the expanded name of + * the file is returned in ErrorFileName. Wildcards are not permitted in + * TargetFileName. TargetFileName can refer to either a file or a direc- + * tory. + * + * The destination can be required to be a file or a directory by the bits + * in Flags. If neither bit0 nor bit1 are set, the destination may be + * either a file or a directory. Flags also controls the copy mode. In a + * ascii copy for the source, the copy stops the first time an EOF + * (control-Z) is encountered. In a ascii copy for the target, the server + * + * must make sure that there is exactly one EOF in the target file and that + * it is the last character of the file. + * + * If the destination is a file and the source contains wildcards, the + * destination file will either be truncated or appended to at the start of + * the operation depending on bits in OpenFunction (see section 3.7). + * Subsequent files will then be appended to the file. + * + * If the negotiated dialect is LM1.2X002 or later, bit5 of Flags is used + * to specify a tree copy on the remote server. When this option is + * selected the destination must not be an existing file and the source + * mode must be binary. A request with bit5 set and either bit0 or bit3 + * set is therefore an error. When the tree copy mode is selected, the + * Count field in the server response is undefined. + * + * 4.2.13.1 Errors + * + * ERRDOS/ERRfilexists + * ERRDOS/ERRshare + * ERRDOS/ERRnofids + * ERRDOS/ERRbadfile + * ERRDOS/ERRnoaccess + * ERRDOS/ERRnofiles + * ERRDOS/ERRbadshare + * ERRSRV/ERRnoaccess + * ERRSRV/ERRinvdevice + * ERRSRV/ERRinvid + * ERRSRV/ERRbaduid + * ERRSRV/ERRaccess + */ + +#include <smbsrv/smb_incl.h> + +/*ARGSUSED*/ +smb_sdrc_t +smb_com_copy(struct smb_request *sr) +{ + return (SDRC_UNIMPLEMENTED); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deleted_files/usr/src/uts/common/fs/smbsrv/smb_find_notify_close.c Wed Mar 05 21:59:55 2008 -0800 @@ -0,0 +1,78 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Client Request Description + * ================================== ================================= + * + * BYTE smb_cmd; FIND_NOTIFY_CLOSE + * BYTE smb_wct; value = 1 + * WORD smb_handle; Find notify handle + * WORD smb_bcc; value = 0 + * + * + * Server Response Description + * ================================== ================================= + * + * BYTE smb_cmd; FIND_NOTIFY_CLOSE + * BYTE smb_wct; value = 0 + * WORD smb_bcc; value = 0 + * + * The FIND_NOTIFY_CLOSE request closes the association between a + * directory handle returned following a resource monitor, established + * using a TRANS2_FIND_NOTIFY_FIRST request to the server, and the + * resulting system directory monitor. This request allows the server + * to free any resources held in support of the open handle. + * + * The Find Close protocol is used to match the DosFindNotifyClose + * OS/2 system call. + * + * Find Notify Close may generate the following errors. + * + * ERRDOS/ERRbadfid + * ERRDOS/<implementation specific> + * ERRSRV/ERRerror + * ERRSRV/ERRinvnid + * ERRSRV/<implementation specific> + * ERRHRD/<implementation specific> + */ + + +#include <smbsrv/smb_incl.h> + + +/* + * smb_com_find_notify_close + * + * As far as I can tell, this part of the protocol is not implemented + * by NT server. + */ +smb_sdrc_t /*ARGSUSED*/ +smb_com_find_notify_close(struct smb_request *sr) +{ + return (SDRC_UNIMPLEMENTED); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deleted_files/usr/src/uts/common/fs/smbsrv/smb_forward.c Wed Mar 05 21:59:55 2008 -0800 @@ -0,0 +1,148 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * This module provides the SMB ForwardUserName interface: + * smb_com_forward_user_name + * smb_com_cancel_forward + * smb_com_get_machine_name + * + * The description of this interface is taken verbatim from the netmon + * SMB protocol help. These functions are currently empty stubs that + * return SDRC_UNIMPLEMENTED. + */ + + +#include <smbsrv/smb_incl.h> + + +/* + * smb_com_forward_user_name + * + * This command informs the server that it should accept messages sent + * to the forwarded name. The name specified in this message does not + * include the one byte suffix ("03" or "05"). + * + * Client Request Description + * ================================== ================================= + * BYTE smb_com SMBfwdname + * BYTE smb_wct 0 + * BYTE smb_bcc min = 2 + * BYTE smb_buf[] ASCII -- 04 + * forwarded name (max 15 bytes) + * + * Server Response Description + * ================================== ================================= + * BYTE smb_com SMBfwdname + * BYTE smb_wct 0 + * BYTE smb_bcc 0 + * + * ForwardUserName may generate the following errors. + * ERRDOS/<implementation specific> + * ERRSRV/ERRerror + * ERRSRV/ERRinvnid + * ERRSRV/ERRrmuns + * ERRSRV/<implementation specific> + * ERRHRD/<implementation specific> + */ +smb_sdrc_t /*ARGSUSED*/ +smb_com_forward_user_name(struct smb_request *sr) +{ + return (SDRC_UNIMPLEMENTED); +} + + +/* + * smb_com_cancel_forward + * + * The CancelForward command cancels the effect of a prior ForwardUserName + * command. The addressed server will no longer accept messages for the + * designated user name. The name specified in this message does not + * include the one byte suffix ("05"). + * + * Client Request Description + * ================================== ================================= + * BYTE smb_com SMBcancelf + * BYTE smb_wct 0 + * BYTE smb_bcc min = 2 + * BYTE smb_buf[] ASCII -- 04 + * forwarded name (max 15 bytes) + * + * Server Response Description + * ================================== ================================= + * BYTE smb_com SMBcancelf + * BYTE smb_wct 0 + * BYTE smb_bcc 0 + * + * CancelForward may generate the following errors. + * ERRDOS/<implementation specific> + * ERRSRV/ERRerror + * ERRSRV/ERRinvnid + * ERRSRV/<implementation specific> + * ERRHRD/<implementation specific> + */ +smb_sdrc_t /*ARGSUSED*/ +smb_com_cancel_forward(struct smb_request *sr) +{ + return (SDRC_UNIMPLEMENTED); +} + + +/* + * smb_com_get_machine_name + * + * The GetMachineName command obtains the machine name of the target machine. + * It is used prior to the CancelForward command to determine to which + * machine the CancelForward command should be sent. GetMachineName is sent + * to the forwarded name to be canceled, and the server then returns the + * machine name to which the CancelForward command must be sent. + * + * Client Request Description + * ================================== ================================= + * BYTE smb_com SMBgetmac + * BYTE smb_wct 0 + * BYTE smb_bcc 0 + * + * Server Response Description + * ================================== ================================= + * BYTE smb_com SMBgetmac + * BYTE smb_wct 0 + * BYTE smb_bcc min = 2 + * BYTE smb_buf[] ASCII -- 04 + * machine name (max 15 bytes) + * + * GetMachineName may return the following errors. + * ERRRDOS/<implementation specific> + * ERRSRV/ERRerror + * ERRSRV/ERRinvnid + * ERRSRV/<implementation specific> + */ +smb_sdrc_t /*ARGSUSED*/ +smb_com_get_machine_name(struct smb_request *sr) +{ + return (SDRC_UNIMPLEMENTED); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deleted_files/usr/src/uts/common/fs/smbsrv/smb_move.c Wed Mar 05 21:59:55 2008 -0800 @@ -0,0 +1,111 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * SMB: move + * + * The source file is copied to the destination and the source is + * subsequently deleted. + * + * Client Request Description + * ================================== ================================= + * + * UCHAR WordCount; Count of parameter words = 3 + * USHORT Tid2; Second (target) file id + * USHORT OpenFunction; what to do if target file exists + * USHORT Flags; Flags to control move operations: + * 0 - target must be a file + * 1 - target must be a directory + * 2 - reserved (must be 0) + * 3 - reserved (must be 0) + * 4 - verify all writes + * USHORT ByteCount; Count of data bytes; min = 2 + * UCHAR Format1; 0x04 + * STRING OldFileName[]; Old file name + * UCHAR FormatNew; 0x04 + * STRING NewFileName[]; New file name + * + * OldFileName is copied to NewFileName, then OldFileName is deleted. Both + * OldFileName and NewFileName must refer to paths on the same server. + * NewFileName can refer to either a file or a directory. All file + * components except the last must exist; directories will not be created. + * + * NewFileName can be required to be a file or a directory by the Flags + * field. + * + * The Tid in the header is associated with the source while Tid2 is + * associated with the destination. These fields may contain the same or + * differing valid values. Tid2 can be set to -1 indicating that this is to + * + * be the same Tid as in the SMB header. This allows use of the move + * protocol with SMB_TREE_CONNECT_ANDX. + * + * Server Response Description + * ================================== ================================= + * + * UCHAR WordCount; Count of parameter words = 1 + * USHORT Count; Number of files moved + * USHORT ByteCount; Count of data bytes; min = 0 + * UCHAR ErrorFileFormat; 0x04 (only if error) + * STRING ErrorFileName[]; Pathname of file where error + * occurred + * + * The source path must refer to an existing file or files. Wildcards are + * permitted. Source files specified by wildcards are processed until an + * error is encountered. If an error is encountered, the expanded name of + * the file is returned in ErrorFileName. Wildcards are not permitted in + * NewFileName. + * + * OpenFunction controls what should happen if the destination file exists. + * If (OpenFunction & 0x30) == 0, the operation should fail if the + * destination exists. If (OpenFunction & 0x30) == 0x20, the destination + * file should be overwritten. + * + * 4.2.12.1 Errors + * + * ERRDOS/ERRfilexists + * ERRDOS/ERRbadfile + * ERRDOS/ERRnoaccess + * ERRDOS/ERRnofiles + * ERRDOS/ERRbadshare + * ERRHRD/ERRnowrite + * ERRSRV/ERRnoaccess + * ERRSRV/ERRinvdevice + * ERRSRV/ERRinvid + * ERRSRV/ERRbaduid + * ERRSRV/ERRnosupport + * ERRSRV/ERRaccess + */ + +#include <smbsrv/smb_incl.h> + +/*ARGSUSED*/ +smb_sdrc_t +smb_com_move(struct smb_request *sr) +{ + return (SDRC_UNIMPLEMENTED); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deleted_files/usr/src/uts/common/fs/smbsrv/smb_trans2_open2.c Wed Mar 05 21:59:55 2008 -0800 @@ -0,0 +1,137 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * SMB: trans2_open2 + * + * This transaction is used to open or create a file having extended + * attributes. + * + * Client Request Value + * ============================ ======================================= + * + * WordCount 15 + * TotalDataCount Total size of extended attribute list + * DataOffset Offset to extended attribute list in + * this request + * SetupCount 1 + * Setup[0] TRANS2_OPEN2 + * + * Parameter Block Encoding Description + * ============================ ======================================= + * + * USHORT Flags; Additional information: bit set- + * 0 - return additional info + * 1 - exclusive oplock requested + * 2 - batch oplock requested + * 3 - return total length of EAs + * USHORT DesiredAccess; Requested file access + * USHORT Reserved1; Ought to be zero. Ignored by the + * server. + * USHORT FileAttributes; Attributes for file if create + * SMB_TIME CreationTime; Creation time to apply to file if + * create + * SMB_DATE CreationDate; Creation date to apply to file if + * create + * USHORT OpenFunction; Open function + * ULONG AllocationSize; Bytes to reserve on create or truncate + * USHORT Reserved [5]; Must be zero + * STRING FileName; Name of file to open or create + * UCHAR Data[ TotalDataCount ] FEAList structure for file to be + * created + * + * If secondary requests are required, they must contain 0 parameter bytes, + * and the Fid in the secondary request is 0xFFFF. + * + * DesiredAccess is encoded as described in the "Access Mode Encoding" + * section elsewhere in this document. + * + * FileAttributes are encoded as described in the "File Attribute Encoding" + * section elsewhere in this document. + * + * OpenFunction specifies the action to be taken depending on whether or + * not the file exists (see section 3.7) . + * + * Action in the response specifies the action as a result of this request + * (see section 3.8). + * + * Response Parameter Block Description + * ========================== ========================================= + * + * USHORT Fid; File handle + * USHORT FileAttributes; Attributes of file + * SMB_TIME CreationTime; Last modification time + * SMB_DATE CreationDate; Last modification date + * ULONG DataSize; Current file size + * USHORT GrantedAccess; Access permissions actually allowed + * USHORT FileType; Type of file + * USHORT DeviceState; State of IPC device (e.g. pipe) + * USHORT Action; Action taken + * ULONG Reserved; + * USHORT EaErrorOffset; Offset into EA list if EA error + * ULONG EaLength; Total EA length for opened file + * + * FileType returns the kind of resource actually opened: + * + * Name Value Description + * ======================= ====== ===================================== + * + * FileTypeDisk 0 Disk file or directory as defined in + * the attribute field + * FileTypeByteModePipe 1 Named pipe in byte mode + * FileTypeMessageModePipe 2 Named pipe in message mode + * FileTypePrinter 3 Spooled printer + * FileTypeUnknown 0xFFFF Unrecognized resource type + * + * DeviceState is applicable only if the FileType is FileTypeByteModePipe + * or FileTypeMessageModePipe and is encoded as in section 3.9. + * + * If an error was detected in the incoming EA list, the offset of the + * error is returned in EaErrorOffset. + * + * If bit0 of Flags in the request is clear, the FileAttributes, + * CreationTime, CreationDate, DataSize, GrantedAccess, FileType, and + * DeviceState have indeterminate values in the response. Similarly, if + * + * bit3 of the request is clear, EaLength in the response has an + * indeterminate value in the response. + * + * This SMB can request an oplock on the opened file. Oplocks are fully + * described in the "Oplocks" section elsewhere in this document, and there + * is also discussion of oplocks in the SMB_COM_LOCKING_ANDX SMB + * description. Bit1 and bit2 of the Flags field are used to request + * oplocks during open. + */ + +#include <smbsrv/smb_incl.h> + +int /*ARGSUSED*/ +smb_com_trans2_open2(struct smb_request *sr) +{ + /* TODO: smb_com_trans2_open2 */ + return (SDRC_UNIMPLEMENTED); +}
--- a/usr/src/cmd/smbsrv/dtrace/Makefile Wed Mar 05 16:14:24 2008 -0800 +++ b/usr/src/cmd/smbsrv/dtrace/Makefile Wed Mar 05 21:59:55 2008 -0800 @@ -19,13 +19,13 @@ # CDDL HEADER END # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -SRCS= stype.d msrpc.d smbvfs.d smbnode.d +SRCS= cifs.d msrpc.d smbnode.d smbvfs.d stype.d include ../../Makefile.cmd
--- a/usr/src/cmd/smbsrv/smbd/smbd_door_server.c Wed Mar 05 16:14:24 2008 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,278 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * SMBd door server - */ - -#include <door.h> -#include <errno.h> -#include <syslog.h> -#include <unistd.h> -#include <stdio.h> -#include <synch.h> -#include <string.h> -#include <sys/stat.h> -#include <fcntl.h> -#include <pthread.h> -#include <syslog.h> -#include <assert.h> -#include <alloca.h> - -#include <smbsrv/libsmb.h> -#include <smbsrv/libsmbns.h> -#include <smbsrv/libsmbrdr.h> - -#include <smbsrv/smb_common_door.h> - -static int smb_door_fildes = -1; -static mutex_t smb_doorsrv_mutex; - -void smb_srv_door(void *, char *, size_t, door_desc_t *, uint_t); - -extern uint32_t smbd_join(smb_joininfo_t *); - -/* - * smb_doorsrv_start - * - * Start the SMBd door service. - * Returns 0 on success. Otherwise, -1. - */ -int -smb_doorsrv_start() -{ - int newfd; - - (void) mutex_lock(&smb_doorsrv_mutex); - - if (smb_door_fildes != -1) { - syslog(LOG_ERR, "smb_doorsrv_start: duplicate"); - (void) mutex_unlock(&smb_doorsrv_mutex); - return (0); - } - - if ((smb_door_fildes = door_create(smb_srv_door, - SMBD_DOOR_COOKIE, DOOR_UNREF)) < 0) { - syslog(LOG_ERR, "smb_doorsrv_start: door_create failed %s", - strerror(errno)); - (void) mutex_unlock(&smb_doorsrv_mutex); - return (-1); - } - - (void) unlink(SMBD_DOOR_NAME); - - if ((newfd = creat(SMBD_DOOR_NAME, 0644)) < 0) { - syslog(LOG_ERR, "smb_doorsrv_start: open failed %s", - strerror(errno)); - (void) door_revoke(smb_door_fildes); - smb_door_fildes = -1; - (void) mutex_unlock(&smb_doorsrv_mutex); - return (-1); - } - - (void) close(newfd); - (void) fdetach(SMBD_DOOR_NAME); - - if (fattach(smb_door_fildes, SMBD_DOOR_NAME) < 0) { - syslog(LOG_ERR, "smb_doorsrv_start: fattach failed %s", - strerror(errno)); - (void) door_revoke(smb_door_fildes); - smb_door_fildes = -1; - (void) mutex_unlock(&smb_doorsrv_mutex); - return (-1); - } - - (void) mutex_unlock(&smb_doorsrv_mutex); - return (0); -} - - -/* - * smb_doorsrv_stop - * - * Stop the smbd door service. - */ -void -smb_doorsrv_stop(void) -{ - (void) mutex_lock(&smb_doorsrv_mutex); - - if (smb_door_fildes != -1) { - (void) fdetach(SMBD_DOOR_NAME); - (void) door_revoke(smb_door_fildes); - smb_door_fildes = -1; - } - - (void) mutex_unlock(&smb_doorsrv_mutex); -} - - -/* - * smb_srv_door - * - */ -/*ARGSUSED*/ -void -smb_srv_door(void *cookie, char *ptr, size_t size, door_desc_t *dp, - uint_t n_desc) -{ - int req_type, rc; - char *buf; - int buflen; - unsigned int used; - smb_dr_ctx_t *dec_ctx; - smb_dr_ctx_t *enc_ctx; - unsigned int dec_status; - unsigned int enc_status; - char *domain; - char *user; - char *passwd; - smb_joininfo_t jdi; - - - dec_ctx = smb_dr_decode_start(ptr, size); - - if (dec_ctx == 0) - return; - - req_type = smb_dr_get_uint32(dec_ctx); - buflen = SMBD_DOOR_SIZE; - - if ((buf = alloca(buflen)) == NULL) { - syslog(LOG_ERR, "SmbdDoorSrv: resource shortage"); - (void) smb_dr_decode_finish(dec_ctx); - return; - } - - enc_ctx = smb_dr_encode_start(buf, buflen); - if (enc_ctx == 0) { - syslog(LOG_ERR, "SmbdDoorSrv: encode start failed"); - (void) smb_dr_decode_finish(dec_ctx); - return; - } - - switch (req_type) { - case SMBD_DOOR_PARAM_GET: { - smb_cfg_id_t id; - char value[MAX_VALUE_BUFLEN]; - - id = smb_dr_get_uint32(dec_ctx); - - dec_status = smb_dr_decode_finish(dec_ctx); - if (dec_status != 0) - goto decode_error; - - (void) smb_config_getstr(id, value, sizeof (value)); - smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_SUCCESS); - smb_dr_put_string(enc_ctx, value); - break; - } - - case SMBD_DOOR_PARAM_SET: { - smb_cfg_id_t id; - char *value = NULL; - - id = smb_dr_get_uint32(dec_ctx); - value = smb_dr_get_string(dec_ctx); - - dec_status = smb_dr_decode_finish(dec_ctx); - if (dec_status != 0) { - smb_dr_free_string(value); - goto decode_error; - } - - if (smb_config_setstr(id, value) == SMBD_SMF_OK) - smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_SUCCESS); - else - smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_ERROR); - smb_dr_free_string(value); - break; - } - - case SMBD_DOOR_NETBIOS_RECONFIG: { - smb_netbios_name_reconfig(); - smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_SUCCESS); - break; - } - - case SMBD_DOOR_JOIN: - jdi.mode = smb_dr_get_uint32(dec_ctx); - domain = smb_dr_get_string(dec_ctx); - user = smb_dr_get_string(dec_ctx); - passwd = smb_dr_get_string(dec_ctx); - - dec_status = smb_dr_decode_finish(dec_ctx); - if (dec_status != 0 || - domain == 0 || user == 0 || passwd == 0) { - smb_dr_free_string(domain); - smb_dr_free_string(user); - smb_dr_free_string(passwd); - goto decode_error; - } - - (void) strlcpy(jdi.domain_name, domain, - sizeof (jdi.domain_name)); - (void) strlcpy(jdi.domain_username, user, - sizeof (jdi.domain_username)); - (void) strlcpy(jdi.domain_passwd, passwd, - sizeof (jdi.domain_passwd)); - - smb_dr_free_string(domain); - smb_dr_free_string(user); - smb_dr_free_string(passwd); - - rc = smbd_join(&jdi); - smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_SUCCESS); - smb_dr_put_int32(enc_ctx, rc); - break; - - default: - goto decode_error; - } - - if ((enc_status = smb_dr_encode_finish(enc_ctx, &used)) != 0) - goto encode_error; - - (void) door_return(buf, used, NULL, 0); - - return; - -decode_error: - (void) smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_ERROR); - (void) smb_dr_put_uint32(enc_ctx, dec_status); - (void) smb_dr_encode_finish(enc_ctx, &used); - (void) door_return(buf, used, NULL, 0); - return; - -encode_error: - enc_ctx = smb_dr_encode_start(buf, buflen); - (void) smb_dr_put_int32(enc_ctx, SMBD_DOOR_SRV_ERROR); - (void) smb_dr_put_uint32(enc_ctx, enc_status); - (void) smb_dr_encode_finish(enc_ctx, &used); - - (void) door_return(buf, used, NULL, 0); -}
--- a/usr/src/lib/smbsrv/libsmb/common/smb_door_client.c Wed Mar 05 16:14:24 2008 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,411 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * User-space door client for SMBd - */ - -#include <fcntl.h> -#include <syslog.h> -#include <door.h> -#include <string.h> -#include <strings.h> -#include <stdlib.h> -#include <errno.h> - -#include <smbsrv/smbinfo.h> -#include <smbsrv/wintypes.h> -#include <smbsrv/ntstatus.h> -#include <smbsrv/alloc.h> -#include <smbsrv/smb_common_door.h> - -#include <smbsrv/libsmb.h> - -static int smb_door_fildes = -1; - -static char *smbd_desc[] = { - "", - "SmbdJoinDomain", - "SmbdGetParam", - "SmbdSetParam", - "SmbdNetbiosReconfig", - 0 -}; - -/* - * Returns 0 on success. Otherwise, -1. - */ -static int -smbd_door_open(int opcode) -{ - int rc = 0; - - if (smb_door_fildes == -1 && - (smb_door_fildes = open(SMBD_DOOR_NAME, O_RDONLY)) < 0) { - syslog(LOG_ERR, "%s: open %s failed %s", smbd_desc[opcode], - SMBD_DOOR_NAME, strerror(errno)); - rc = -1; - } - - return (rc); -} - -/* - * Return 0 upon success. Otherwise, -1. - */ -static int -smbd_door_check_srv_status(int opcode, smb_dr_ctx_t *dec_ctx) -{ - int status = smb_dr_get_int32(dec_ctx); - int err; - int rc = -1; - - switch (status) { - case SMBD_DOOR_SRV_SUCCESS: - rc = 0; - break; - - case SMBD_DOOR_SRV_ERROR: - err = smb_dr_get_uint32(dec_ctx); - syslog(LOG_ERR, "%s: Encountered door server error %s", - smbd_desc[opcode], strerror(err)); - break; - - default: - syslog(LOG_ERR, "%s: Unknown door server status", - smbd_desc[opcode]); - } - - if (rc != 0) { - if ((err = smb_dr_decode_finish(dec_ctx)) != 0) { - syslog(LOG_ERR, "%s: Decode error %s", - smbd_desc[opcode], strerror(err)); - } - } - - return (rc); -} - -uint32_t -smb_join(smb_joininfo_t *jdi) -{ - door_arg_t arg; - char *buf; - uint32_t used; - smb_dr_ctx_t *dec_ctx; - smb_dr_ctx_t *enc_ctx; - int status; - uint32_t rc; - int opcode = SMBD_DOOR_JOIN; - - if ((jdi == 0) || (*jdi->domain_name == 0)) { - syslog(LOG_ERR, "%s: invalid parameter(s)", smbd_desc[opcode]); - return (NT_STATUS_INVALID_PARAMETER); - } - - if (smbd_door_open(opcode) == -1) { - syslog(LOG_ERR, "%s: cannot open the door", smbd_desc[opcode]); - return (NT_STATUS_INTERNAL_ERROR); - } - - buf = MEM_MALLOC("smb_door_client", SMBD_DOOR_SIZE); - if (!buf) { - syslog(LOG_ERR, "%s: resource shortage", smbd_desc[opcode]); - return (NT_STATUS_NO_MEMORY); - } - - enc_ctx = smb_dr_encode_start(buf, SMBD_DOOR_SIZE); - if (enc_ctx == 0) { - syslog(LOG_ERR, "%s: encode start failed", smbd_desc[opcode]); - MEM_FREE("smb_door_client", buf); - return (NT_STATUS_INTERNAL_ERROR); - } - - smb_dr_put_uint32(enc_ctx, opcode); - smb_dr_put_uint32(enc_ctx, jdi->mode); - smb_dr_put_string(enc_ctx, jdi->domain_name); - smb_dr_put_string(enc_ctx, jdi->domain_username); - smb_dr_put_string(enc_ctx, jdi->domain_passwd); - - if ((status = smb_dr_encode_finish(enc_ctx, &used)) != 0) { - syslog(LOG_ERR, "%s: Encode error %s", - smbd_desc[opcode], strerror(status)); - MEM_FREE("smb_door_client", buf); - return (NT_STATUS_INTERNAL_ERROR); - } - - arg.data_ptr = buf; - arg.data_size = used; - arg.desc_ptr = NULL; - arg.desc_num = 0; - arg.rbuf = buf; - arg.rsize = SMBD_DOOR_SIZE; - - if (door_call(smb_door_fildes, &arg) < 0) { - syslog(LOG_ERR, "%s: Door call failed %s", smbd_desc[opcode], - strerror(errno)); - MEM_FREE("smb_door_client", buf); - smb_door_fildes = -1; - return (NT_STATUS_INTERNAL_ERROR); - } - - dec_ctx = smb_dr_decode_start(arg.data_ptr, arg.data_size); - if (smbd_door_check_srv_status(opcode, dec_ctx) != 0) { - MEM_FREE("smb_door_client", buf); - return (NT_STATUS_INTERNAL_ERROR); - } - - rc = smb_dr_get_uint32(dec_ctx); - if ((status = smb_dr_decode_finish(dec_ctx)) != 0) { - syslog(LOG_ERR, "%s: Decode error %s", - smbd_desc[opcode], strerror(status)); - MEM_FREE("smb_door_client", buf); - return (NT_STATUS_INTERNAL_ERROR); - } - - MEM_FREE("smb_door_client", buf); - return (rc); -} - -int -smbd_netbios_reconfig() -{ - door_arg_t arg; - char *buf; - uint32_t used; - smb_dr_ctx_t *dec_ctx; - smb_dr_ctx_t *enc_ctx; - int status; - DWORD rc; - int opcode = SMBD_DOOR_NETBIOS_RECONFIG; - - if (smbd_door_open(opcode) == -1) { - syslog(LOG_ERR, "%s: cannot open the door", smbd_desc[opcode]); - return (1); - } - - buf = MEM_MALLOC("smb_door_client", SMBD_DOOR_SIZE); - if (!buf) { - syslog(LOG_ERR, "%s: resource shortage", smbd_desc[opcode]); - return (1); - } - - enc_ctx = smb_dr_encode_start(buf, SMBD_DOOR_SIZE); - if (enc_ctx == 0) { - syslog(LOG_ERR, "%s: encode start failed", smbd_desc[opcode]); - MEM_FREE("smb_door_client", buf); - return (1); - } - - smb_dr_put_uint32(enc_ctx, opcode); - - if ((status = smb_dr_encode_finish(enc_ctx, &used)) != 0) { - syslog(LOG_ERR, "%s: Encode error %s", - smbd_desc[opcode], strerror(status)); - MEM_FREE("smb_door_client", buf); - return (1); - } - - arg.data_ptr = buf; - arg.data_size = used; - arg.desc_ptr = NULL; - arg.desc_num = 0; - arg.rbuf = buf; - arg.rsize = SMBD_DOOR_SIZE; - - if (door_call(smb_door_fildes, &arg) < 0) { - syslog(LOG_ERR, "%s: Door call failed %s", smbd_desc[opcode], - strerror(errno)); - MEM_FREE("smb_door_client", buf); - smb_door_fildes = -1; - return (1); - } - - dec_ctx = smb_dr_decode_start(arg.data_ptr, arg.data_size); - rc = smb_dr_get_uint32(dec_ctx); - - if ((status = smb_dr_decode_finish(dec_ctx)) != 0) { - syslog(LOG_ERR, "%s: Decode error %s", - smbd_desc[opcode], strerror(status)); - MEM_FREE("smb_door_client", buf); - return (1); - } - MEM_FREE("smb_door_client", buf); - return (rc); -} - -int -smbd_set_param(smb_cfg_id_t id, char *value) -{ - door_arg_t arg; - char *buf; - uint32_t used; - smb_dr_ctx_t *dec_ctx; - smb_dr_ctx_t *enc_ctx; - int status; - DWORD rc; - int opcode = SMBD_DOOR_PARAM_SET; - - if (smbd_door_open(opcode) == -1) { - syslog(LOG_ERR, "%s: cannot open the door", smbd_desc[opcode]); - return (1); - } - - buf = MEM_MALLOC("smb_door_client", SMBD_DOOR_SIZE); - if (!buf) { - syslog(LOG_ERR, "%s: resource shortage", smbd_desc[opcode]); - return (1); - } - - enc_ctx = smb_dr_encode_start(buf, SMBD_DOOR_SIZE); - if (enc_ctx == 0) { - syslog(LOG_ERR, "%s: encode start failed", smbd_desc[opcode]); - MEM_FREE("smb_door_client", buf); - return (1); - } - - smb_dr_put_uint32(enc_ctx, opcode); - smb_dr_put_uint32(enc_ctx, id); - smb_dr_put_string(enc_ctx, value); - - if ((status = smb_dr_encode_finish(enc_ctx, &used)) != 0) { - syslog(LOG_ERR, "%s: Encode error %s", - smbd_desc[opcode], strerror(status)); - MEM_FREE("smb_door_client", buf); - return (1); - } - - arg.data_ptr = buf; - arg.data_size = used; - arg.desc_ptr = NULL; - arg.desc_num = 0; - arg.rbuf = buf; - arg.rsize = SMBD_DOOR_SIZE; - - if (door_call(smb_door_fildes, &arg) < 0) { - syslog(LOG_ERR, "%s: Door call failed %s", smbd_desc[opcode], - strerror(errno)); - MEM_FREE("smb_door_client", buf); - smb_door_fildes = -1; - return (1); - } - - dec_ctx = smb_dr_decode_start(arg.data_ptr, arg.data_size); - rc = smb_dr_get_uint32(dec_ctx); - - if ((status = smb_dr_decode_finish(dec_ctx)) != 0) { - syslog(LOG_ERR, "%s: Decode error %s", - smbd_desc[opcode], strerror(status)); - MEM_FREE("smb_door_client", buf); - return (1); - } - MEM_FREE("smb_door_client", buf); - return (rc); -} - -int -smbd_get_param(smb_cfg_id_t id, char *value) -{ - door_arg_t arg; - char *buf; - char *tmp = NULL; - uint32_t used; - smb_dr_ctx_t *dec_ctx; - smb_dr_ctx_t *enc_ctx; - int status; - DWORD rc; - int opcode = SMBD_DOOR_PARAM_GET; - - if (smbd_door_open(opcode) == -1) { - syslog(LOG_ERR, "%s: cannot open the door", smbd_desc[opcode]); - return (1); - } - - buf = MEM_MALLOC("smb_door_client", SMBD_DOOR_SIZE); - if (!buf) { - syslog(LOG_ERR, "%s: resource shortage", smbd_desc[opcode]); - return (1); - } - - enc_ctx = smb_dr_encode_start(buf, SMBD_DOOR_SIZE); - if (enc_ctx == 0) { - syslog(LOG_ERR, "%s: encode start failed", smbd_desc[opcode]); - MEM_FREE("smb_door_client", buf); - return (1); - } - - smb_dr_put_uint32(enc_ctx, opcode); - smb_dr_put_uint32(enc_ctx, id); - - if ((status = smb_dr_encode_finish(enc_ctx, &used)) != 0) { - syslog(LOG_ERR, "%s: Encode error %s", - smbd_desc[opcode], strerror(status)); - MEM_FREE("smb_door_client", buf); - return (1); - } - - arg.data_ptr = buf; - arg.data_size = used; - arg.desc_ptr = NULL; - arg.desc_num = 0; - arg.rbuf = buf; - arg.rsize = SMBD_DOOR_SIZE; - - if (door_call(smb_door_fildes, &arg) < 0) { - syslog(LOG_ERR, "%s: Door call failed %s", smbd_desc[opcode], - strerror(errno)); - MEM_FREE("smb_door_client", buf); - smb_door_fildes = -1; - return (1); - } - - dec_ctx = smb_dr_decode_start(arg.data_ptr, arg.data_size); - rc = smb_dr_get_uint32(dec_ctx); - tmp = smb_dr_get_string(dec_ctx); - (void) strcpy(value, tmp); - - if ((status = smb_dr_decode_finish(dec_ctx)) != 0) { - syslog(LOG_ERR, "%s: Decode error %s", - smbd_desc[opcode], strerror(status)); - MEM_FREE("smb_door_client", buf); - return (1); - } - MEM_FREE("smb_door_client", buf); - return (rc); -} - -int -smbd_get_security_mode(int *mode) -{ - char buf[64]; - int rc; - - buf[0] = '\0'; - rc = smbd_get_param(SMB_CI_SECURITY, buf); - *mode = smb_config_secmode_fromstr(buf); - return (rc); -}
--- a/usr/src/pkgdefs/etc/exception_list_i386 Wed Mar 05 16:14:24 2008 -0800 +++ b/usr/src/pkgdefs/etc/exception_list_i386 Wed Mar 05 21:59:55 2008 -0800 @@ -1023,6 +1023,7 @@ # Private/Internal dtrace scripts of smbsrv. Do not ship. # usr/lib/smbsrv/dtrace i386 +usr/lib/smbsrv/dtrace/cifs.d i386 usr/lib/smbsrv/dtrace/msrpc.d i386 usr/lib/smbsrv/dtrace/smbnode.d i386 usr/lib/smbsrv/dtrace/smbvfs.d i386
--- a/usr/src/pkgdefs/etc/exception_list_sparc Wed Mar 05 16:14:24 2008 -0800 +++ b/usr/src/pkgdefs/etc/exception_list_sparc Wed Mar 05 21:59:55 2008 -0800 @@ -1108,6 +1108,7 @@ # Private/Internal dtrace scripts of smbsrv. Do not ship. # usr/lib/smbsrv/dtrace sparc +usr/lib/smbsrv/dtrace/cifs.d sparc usr/lib/smbsrv/dtrace/msrpc.d sparc usr/lib/smbsrv/dtrace/smbnode.d sparc usr/lib/smbsrv/dtrace/smbvfs.d sparc
--- a/usr/src/uts/common/fs/smbsrv/smb_copy.c Wed Mar 05 16:14:24 2008 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * SMB: copy_file - * - * Client Request Description - * ================================== ================================= - * - * UCHAR WordCount; Count of parameter words = 3 - * USHORT Tid2; Second (target) path TID - * USHORT OpenFunction; What to do if target file exists - * USHORT Flags; Flags to control copy operation: - * bit 0 - target must be a file - * bit 1 - target must be a dir. - * bit 2 - copy target mode: - * 0 = binary, 1 = ASCII - * bit 3 - copy source mode: - * 0 = binary, 1 = ASCII - * bit 4 - verify all writes - * bit 5 - tree copy - * USHORT ByteCount; Count of data bytes; min = 2 - * UCHAR SourceFileNameFormat; 0x04 - * STRING SourceFileName; Pathname of source file - * UCHAR TargetFileNameFormat; 0x04 - * STRING TargetFileName; Pathname of target file - * - * The file at SourceName is copied to TargetFileName, both of which must refer - * to paths on the same server. - * - * The Tid in the header is associated with the source while Tid2 is - * associated with the destination. These fields may contain the same or - * differing valid values. Tid2 can be set to -1 indicating that this is to - * be the same Tid as in the SMB header. This allows use of the move - * protocol with SMB_TREE_CONNECT_ANDX. - * - * Server Response Description - * ================================== ================================= - * - * UCHAR WordCount; Count of parameter words = 1 - * USHORT Count; Number of files copied - * USHORT ByteCount; Count of data bytes; min = 0 - * UCHAR ErrorFileFormat; 0x04 (only if error) - * STRING ErrorFileName; - * - * The source path must refer to an existing file or files. Wildcards are - * permitted. Source files specified by wildcards are processed until an - * error is encountered. If an error is encountered, the expanded name of - * the file is returned in ErrorFileName. Wildcards are not permitted in - * TargetFileName. TargetFileName can refer to either a file or a direc- - * tory. - * - * The destination can be required to be a file or a directory by the bits - * in Flags. If neither bit0 nor bit1 are set, the destination may be - * either a file or a directory. Flags also controls the copy mode. In a - * ascii copy for the source, the copy stops the first time an EOF - * (control-Z) is encountered. In a ascii copy for the target, the server - * - * must make sure that there is exactly one EOF in the target file and that - * it is the last character of the file. - * - * If the destination is a file and the source contains wildcards, the - * destination file will either be truncated or appended to at the start of - * the operation depending on bits in OpenFunction (see section 3.7). - * Subsequent files will then be appended to the file. - * - * If the negotiated dialect is LM1.2X002 or later, bit5 of Flags is used - * to specify a tree copy on the remote server. When this option is - * selected the destination must not be an existing file and the source - * mode must be binary. A request with bit5 set and either bit0 or bit3 - * set is therefore an error. When the tree copy mode is selected, the - * Count field in the server response is undefined. - * - * 4.2.13.1 Errors - * - * ERRDOS/ERRfilexists - * ERRDOS/ERRshare - * ERRDOS/ERRnofids - * ERRDOS/ERRbadfile - * ERRDOS/ERRnoaccess - * ERRDOS/ERRnofiles - * ERRDOS/ERRbadshare - * ERRSRV/ERRnoaccess - * ERRSRV/ERRinvdevice - * ERRSRV/ERRinvid - * ERRSRV/ERRbaduid - * ERRSRV/ERRaccess - */ - -#include <smbsrv/smb_incl.h> - -/*ARGSUSED*/ -smb_sdrc_t -smb_com_copy(struct smb_request *sr) -{ - return (SDRC_UNIMPLEMENTED); -}
--- a/usr/src/uts/common/fs/smbsrv/smb_find_notify_close.c Wed Mar 05 16:14:24 2008 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * Client Request Description - * ================================== ================================= - * - * BYTE smb_cmd; FIND_NOTIFY_CLOSE - * BYTE smb_wct; value = 1 - * WORD smb_handle; Find notify handle - * WORD smb_bcc; value = 0 - * - * - * Server Response Description - * ================================== ================================= - * - * BYTE smb_cmd; FIND_NOTIFY_CLOSE - * BYTE smb_wct; value = 0 - * WORD smb_bcc; value = 0 - * - * The FIND_NOTIFY_CLOSE request closes the association between a - * directory handle returned following a resource monitor, established - * using a TRANS2_FIND_NOTIFY_FIRST request to the server, and the - * resulting system directory monitor. This request allows the server - * to free any resources held in support of the open handle. - * - * The Find Close protocol is used to match the DosFindNotifyClose - * OS/2 system call. - * - * Find Notify Close may generate the following errors. - * - * ERRDOS/ERRbadfid - * ERRDOS/<implementation specific> - * ERRSRV/ERRerror - * ERRSRV/ERRinvnid - * ERRSRV/<implementation specific> - * ERRHRD/<implementation specific> - */ - - -#include <smbsrv/smb_incl.h> - - -/* - * smb_com_find_notify_close - * - * As far as I can tell, this part of the protocol is not implemented - * by NT server. - */ -smb_sdrc_t /*ARGSUSED*/ -smb_com_find_notify_close(struct smb_request *sr) -{ - return (SDRC_UNIMPLEMENTED); -}
--- a/usr/src/uts/common/fs/smbsrv/smb_forward.c Wed Mar 05 16:14:24 2008 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,148 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This module provides the SMB ForwardUserName interface: - * smb_com_forward_user_name - * smb_com_cancel_forward - * smb_com_get_machine_name - * - * The description of this interface is taken verbatim from the netmon - * SMB protocol help. These functions are currently empty stubs that - * return SDRC_UNIMPLEMENTED. - */ - - -#include <smbsrv/smb_incl.h> - - -/* - * smb_com_forward_user_name - * - * This command informs the server that it should accept messages sent - * to the forwarded name. The name specified in this message does not - * include the one byte suffix ("03" or "05"). - * - * Client Request Description - * ================================== ================================= - * BYTE smb_com SMBfwdname - * BYTE smb_wct 0 - * BYTE smb_bcc min = 2 - * BYTE smb_buf[] ASCII -- 04 - * forwarded name (max 15 bytes) - * - * Server Response Description - * ================================== ================================= - * BYTE smb_com SMBfwdname - * BYTE smb_wct 0 - * BYTE smb_bcc 0 - * - * ForwardUserName may generate the following errors. - * ERRDOS/<implementation specific> - * ERRSRV/ERRerror - * ERRSRV/ERRinvnid - * ERRSRV/ERRrmuns - * ERRSRV/<implementation specific> - * ERRHRD/<implementation specific> - */ -smb_sdrc_t /*ARGSUSED*/ -smb_com_forward_user_name(struct smb_request *sr) -{ - return (SDRC_UNIMPLEMENTED); -} - - -/* - * smb_com_cancel_forward - * - * The CancelForward command cancels the effect of a prior ForwardUserName - * command. The addressed server will no longer accept messages for the - * designated user name. The name specified in this message does not - * include the one byte suffix ("05"). - * - * Client Request Description - * ================================== ================================= - * BYTE smb_com SMBcancelf - * BYTE smb_wct 0 - * BYTE smb_bcc min = 2 - * BYTE smb_buf[] ASCII -- 04 - * forwarded name (max 15 bytes) - * - * Server Response Description - * ================================== ================================= - * BYTE smb_com SMBcancelf - * BYTE smb_wct 0 - * BYTE smb_bcc 0 - * - * CancelForward may generate the following errors. - * ERRDOS/<implementation specific> - * ERRSRV/ERRerror - * ERRSRV/ERRinvnid - * ERRSRV/<implementation specific> - * ERRHRD/<implementation specific> - */ -smb_sdrc_t /*ARGSUSED*/ -smb_com_cancel_forward(struct smb_request *sr) -{ - return (SDRC_UNIMPLEMENTED); -} - - -/* - * smb_com_get_machine_name - * - * The GetMachineName command obtains the machine name of the target machine. - * It is used prior to the CancelForward command to determine to which - * machine the CancelForward command should be sent. GetMachineName is sent - * to the forwarded name to be canceled, and the server then returns the - * machine name to which the CancelForward command must be sent. - * - * Client Request Description - * ================================== ================================= - * BYTE smb_com SMBgetmac - * BYTE smb_wct 0 - * BYTE smb_bcc 0 - * - * Server Response Description - * ================================== ================================= - * BYTE smb_com SMBgetmac - * BYTE smb_wct 0 - * BYTE smb_bcc min = 2 - * BYTE smb_buf[] ASCII -- 04 - * machine name (max 15 bytes) - * - * GetMachineName may return the following errors. - * ERRRDOS/<implementation specific> - * ERRSRV/ERRerror - * ERRSRV/ERRinvnid - * ERRSRV/<implementation specific> - */ -smb_sdrc_t /*ARGSUSED*/ -smb_com_get_machine_name(struct smb_request *sr) -{ - return (SDRC_UNIMPLEMENTED); -}
--- a/usr/src/uts/common/fs/smbsrv/smb_move.c Wed Mar 05 16:14:24 2008 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * SMB: move - * - * The source file is copied to the destination and the source is - * subsequently deleted. - * - * Client Request Description - * ================================== ================================= - * - * UCHAR WordCount; Count of parameter words = 3 - * USHORT Tid2; Second (target) file id - * USHORT OpenFunction; what to do if target file exists - * USHORT Flags; Flags to control move operations: - * 0 - target must be a file - * 1 - target must be a directory - * 2 - reserved (must be 0) - * 3 - reserved (must be 0) - * 4 - verify all writes - * USHORT ByteCount; Count of data bytes; min = 2 - * UCHAR Format1; 0x04 - * STRING OldFileName[]; Old file name - * UCHAR FormatNew; 0x04 - * STRING NewFileName[]; New file name - * - * OldFileName is copied to NewFileName, then OldFileName is deleted. Both - * OldFileName and NewFileName must refer to paths on the same server. - * NewFileName can refer to either a file or a directory. All file - * components except the last must exist; directories will not be created. - * - * NewFileName can be required to be a file or a directory by the Flags - * field. - * - * The Tid in the header is associated with the source while Tid2 is - * associated with the destination. These fields may contain the same or - * differing valid values. Tid2 can be set to -1 indicating that this is to - * - * be the same Tid as in the SMB header. This allows use of the move - * protocol with SMB_TREE_CONNECT_ANDX. - * - * Server Response Description - * ================================== ================================= - * - * UCHAR WordCount; Count of parameter words = 1 - * USHORT Count; Number of files moved - * USHORT ByteCount; Count of data bytes; min = 0 - * UCHAR ErrorFileFormat; 0x04 (only if error) - * STRING ErrorFileName[]; Pathname of file where error - * occurred - * - * The source path must refer to an existing file or files. Wildcards are - * permitted. Source files specified by wildcards are processed until an - * error is encountered. If an error is encountered, the expanded name of - * the file is returned in ErrorFileName. Wildcards are not permitted in - * NewFileName. - * - * OpenFunction controls what should happen if the destination file exists. - * If (OpenFunction & 0x30) == 0, the operation should fail if the - * destination exists. If (OpenFunction & 0x30) == 0x20, the destination - * file should be overwritten. - * - * 4.2.12.1 Errors - * - * ERRDOS/ERRfilexists - * ERRDOS/ERRbadfile - * ERRDOS/ERRnoaccess - * ERRDOS/ERRnofiles - * ERRDOS/ERRbadshare - * ERRHRD/ERRnowrite - * ERRSRV/ERRnoaccess - * ERRSRV/ERRinvdevice - * ERRSRV/ERRinvid - * ERRSRV/ERRbaduid - * ERRSRV/ERRnosupport - * ERRSRV/ERRaccess - */ - -#include <smbsrv/smb_incl.h> - -/*ARGSUSED*/ -smb_sdrc_t -smb_com_move(struct smb_request *sr) -{ - return (SDRC_UNIMPLEMENTED); -}
--- a/usr/src/uts/common/fs/smbsrv/smb_trans2_open2.c Wed Mar 05 16:14:24 2008 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* - * CDDL HEADER START - * - * The contents of this file are subject to the terms of the - * Common Development and Distribution License (the "License"). - * You may not use this file except in compliance with the License. - * - * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE - * or http://www.opensolaris.org/os/licensing. - * See the License for the specific language governing permissions - * and limitations under the License. - * - * When distributing Covered Code, include this CDDL HEADER in each - * file and include the License file at usr/src/OPENSOLARIS.LICENSE. - * If applicable, add the following below this CDDL HEADER, with the - * fields enclosed by brackets "[]" replaced with your own identifying - * information: Portions Copyright [yyyy] [name of copyright owner] - * - * CDDL HEADER END - */ -/* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * SMB: trans2_open2 - * - * This transaction is used to open or create a file having extended - * attributes. - * - * Client Request Value - * ============================ ======================================= - * - * WordCount 15 - * TotalDataCount Total size of extended attribute list - * DataOffset Offset to extended attribute list in - * this request - * SetupCount 1 - * Setup[0] TRANS2_OPEN2 - * - * Parameter Block Encoding Description - * ============================ ======================================= - * - * USHORT Flags; Additional information: bit set- - * 0 - return additional info - * 1 - exclusive oplock requested - * 2 - batch oplock requested - * 3 - return total length of EAs - * USHORT DesiredAccess; Requested file access - * USHORT Reserved1; Ought to be zero. Ignored by the - * server. - * USHORT FileAttributes; Attributes for file if create - * SMB_TIME CreationTime; Creation time to apply to file if - * create - * SMB_DATE CreationDate; Creation date to apply to file if - * create - * USHORT OpenFunction; Open function - * ULONG AllocationSize; Bytes to reserve on create or truncate - * USHORT Reserved [5]; Must be zero - * STRING FileName; Name of file to open or create - * UCHAR Data[ TotalDataCount ] FEAList structure for file to be - * created - * - * If secondary requests are required, they must contain 0 parameter bytes, - * and the Fid in the secondary request is 0xFFFF. - * - * DesiredAccess is encoded as described in the "Access Mode Encoding" - * section elsewhere in this document. - * - * FileAttributes are encoded as described in the "File Attribute Encoding" - * section elsewhere in this document. - * - * OpenFunction specifies the action to be taken depending on whether or - * not the file exists (see section 3.7) . - * - * Action in the response specifies the action as a result of this request - * (see section 3.8). - * - * Response Parameter Block Description - * ========================== ========================================= - * - * USHORT Fid; File handle - * USHORT FileAttributes; Attributes of file - * SMB_TIME CreationTime; Last modification time - * SMB_DATE CreationDate; Last modification date - * ULONG DataSize; Current file size - * USHORT GrantedAccess; Access permissions actually allowed - * USHORT FileType; Type of file - * USHORT DeviceState; State of IPC device (e.g. pipe) - * USHORT Action; Action taken - * ULONG Reserved; - * USHORT EaErrorOffset; Offset into EA list if EA error - * ULONG EaLength; Total EA length for opened file - * - * FileType returns the kind of resource actually opened: - * - * Name Value Description - * ======================= ====== ===================================== - * - * FileTypeDisk 0 Disk file or directory as defined in - * the attribute field - * FileTypeByteModePipe 1 Named pipe in byte mode - * FileTypeMessageModePipe 2 Named pipe in message mode - * FileTypePrinter 3 Spooled printer - * FileTypeUnknown 0xFFFF Unrecognized resource type - * - * DeviceState is applicable only if the FileType is FileTypeByteModePipe - * or FileTypeMessageModePipe and is encoded as in section 3.9. - * - * If an error was detected in the incoming EA list, the offset of the - * error is returned in EaErrorOffset. - * - * If bit0 of Flags in the request is clear, the FileAttributes, - * CreationTime, CreationDate, DataSize, GrantedAccess, FileType, and - * DeviceState have indeterminate values in the response. Similarly, if - * - * bit3 of the request is clear, EaLength in the response has an - * indeterminate value in the response. - * - * This SMB can request an oplock on the opened file. Oplocks are fully - * described in the "Oplocks" section elsewhere in this document, and there - * is also discussion of oplocks in the SMB_COM_LOCKING_ANDX SMB - * description. Bit1 and bit2 of the Flags field are used to request - * oplocks during open. - */ - -#include <smbsrv/smb_incl.h> - -int /*ARGSUSED*/ -smb_com_trans2_open2(struct smb_request *sr) -{ - /* TODO: smb_com_trans2_open2 */ - return (SDRC_UNIMPLEMENTED); -}