view usr/src/uts/common/smbsrv/mlsvc.h @ 7961:4b5e3051f38b

6751647 TRANS2_FIND_NEXT continuation by filename restarts search at beginning of directory 6753904 SVCCTL server side service 6741484 Local users cannot connect to CIFS shares from MacOS 10.5 6746898 win98 can not overwrite *.files 6753310 Incorrect handling of SmbNegotiate request when invalid dialects are negotiated. 6751123 Unable to join domain, core dump generated with IPMP setting 6722437 SMB_TRANS2_FIND returns wrong status code when stream file is passed 6716578 can not delete file in extended attribute name space in cifs client when cifs server is solaris PSARC 2008/584 Correction in nbmand behavior 6734067 Long delay when viewing MS Word Read-only file properties with nbmand enabled. PSARC/2007/281 NFS share properties for Montana compatibility 6475452 Need Solaris support for Montana approve file functionality in NFS 6582170 Host-based access control (approve file) 6749075 Unable to join domain if user password exceeds 20 characters 6612716 Join domain fails if hostname is > 15 chars 6753251 server signing: wrong signature is generated for the NetShareEnum reply 6757521 SMB daemon leaks memory after displaying GSS status 6760315 Local user cannot connnect to CIFS shares if CIFS server's hostname is not specified 6757333 Share publisher thread runs into infinite loop of displaying GSS major/minor status 6757132 smbd crashes at smb_idmap_batch_getmappings 6760876 security descriptor decoding function has a glitch 6761491 Cannot open or delete a named stream on a directory file. 6741449 Cleanup list in smbns_ads module 6593958 Users with restore privilege can take ownership of files
author natalie li - Sun Microsystems - Irvine United States <Natalie.Li@Sun.COM>
date Tue, 28 Oct 2008 03:34:04 -0700
parents efa04b030974
children
line wrap: on
line source

/*
 * 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.
 */

#ifndef _SMBSRV_MLSVC_H
#define	_SMBSRV_MLSVC_H

/*
 * MLSVC RPC layer public interface definitions.
 */

#include <sys/param.h>
#include <sys/uio.h>
#include <sys/ksynch.h>

#include <smbsrv/wintypes.h>
#include <smbsrv/smb_xdr.h>


#ifdef __cplusplus
extern "C" {
#endif

/*
 * RPC strings
 *
 * DCE RPC strings (CAE section 14.3.4) are represented as varying or
 * varying and conformant one-dimensional arrays. Characters can be
 * single-byte or multi-byte as long as all characters conform to a
 * fixed element size, i.e. UCS-2 is okay but UTF-8 is not a valid
 * DCE RPC string format. The string is terminated by a null character
 * of the appropriate element size.
 *
 * MSRPC strings are always varying and conformant format and not null
 * terminated. This format uses the size_is, first_is and length_is
 * attributes (CAE section 4.2.18).
 *
 *	typedef struct mlrpc_string {
 *		DWORD size_is;
 *		DWORD first_is;
 *		DWORD length_is;
 *		wchar_t string[ANY_SIZE_ARRAY];
 *  } mlrpc_string_t;
 *
 * The size_is attribute is used to specify the number of data elements
 * in each dimension of an array.
 *
 * The first_is attribute is used to define the lower bound for
 * significant elements in each dimension of an array. For strings
 * this is always 0.
 *
 * The length_is attribute is used to define the number of significant
 * elements in each dimension of an array. For strings this is typically
 * the same as size_is. Although it might be (size_is - 1) if the string
 * is null terminated.
 *
 * In MSRPC, Unicode strings are not null terminated. This means
 * that the recipient has to manually null-terminate the string after
 * it has been unmarshalled. Note that there is often a wide-char pad
 * following a string. Although the padding sometimes contains zero,
 * it's not guaranteed.
 *
 *   4 bytes   4 bytes   4 bytes  2bytes 2bytes 2bytes 2bytes
 * +---------+---------+---------+------+------+------+------+
 * |size_is  |first_is |length_is| char | char | char | char |
 * +---------+---------+---------+------+------+------+------+
 *
 * The problem is that some strings are null terminated. This seems
 * to conflict with the statement above that Unicode strings are not
 * null terminated, which may be a historical thing from earlier
 * implementations or it may be that different services do different
 * things. So there is an additional string wrapper with two more
 * fields used in some RPC structures as shown below (LPTSTR is
 * automatically converted to mlrpc_string by the NDR marshalling).
 *
 * typedef struct ms_string {
 *		WORD length;
 *		WORD maxlen;
 *		LPTSTR str;
 * } ms_string_t;
 *
 * Here, length is the array length in bytes excluding any terminating
 * null bytes and maxlen is the array length in bytes including null
 * terminator bytes.
 */
typedef struct mlsvc_string {
	WORD length;
	WORD maxlen;
	LPTSTR str;
} mlsvc_string_t;

/*
 * The maximum number of domains (NT limit).
 */
#define	MLSVC_DOMAIN_MAX		32

/* 32-byte machine account password (null-terminated) */
#define	MLSVC_MACHINE_ACCT_PASSWD_MAX	32 + 1

/*
 * Status code returned from enumeration RPCs to indicate
 * that the server has no more data. Normally returned at
 * severity level ERROR_SEVERITY_WARNING.
 */
#define	MLSVC_NO_MORE_DATA		0x1A

#define	MLSVC_ANON_USER			"IPC$"

char *mlsvc_ipc_name(int ipc_type, char *username);

/*
 * Passthrough negotiation and authentication interface.
 *
 * NT supports two forms of password: a Lanman (case-insensitive)
 * password and an NT (case-sensitive) password. If either of the
 * passwords is not available its pointer and length should be set
 * to zero. The session key and vc number are required to validate
 * the encrypted passwords.
 */

void mlsvc_nt_password_hash(char *result, char *password);
int mlsvc_encrypt_nt_password(char *password, char *key, int keylen, char *out,
    int outmax);
DWORD mlsvc_join(char *server, char *domain, char *username, char *password);

/*
 * RPC request processing interface (mlsvc_server.c).
 */
#define	MLSVC_MAX_IOVEC			512

typedef struct mlrpc_frag {
	struct mlrpc_frag *next;
	struct mbuf *mhead;
	uint32_t length;
} mlrpc_frag_t;

typedef struct mlsvc_stream {
	mlrpc_frag_t *head;
	mlrpc_frag_t *tail;
	mlrpc_frag_t *pending;
	unsigned int nfrag;
	struct uio uio;
	struct iovec iovec[MLSVC_MAX_IOVEC];
} mlsvc_stream_t;

typedef struct mlsvc_pipe {
	kmutex_t mutex;
	kcondvar_t cv;
	uint32_t busy;
	uint32_t fid;
	char *pipe_name;
	mlsvc_stream_t input;
	uchar_t *output;
	int32_t outlen;
} mlsvc_pipe_t;

void mlsvc_rpc_report_status(int opnum, DWORD status);

#ifdef __cplusplus
}
#endif


#endif /* _SMBSRV_MLSVC_H */