smb_common_transact.c revision da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0
/*
* 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
* 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"
#include <smbsrv/smb_incl.h>
#include <smbsrv/smb_fsops.h>
#include <smbsrv/mailslot.h>
extern int smb_maxbufsize;
#define MAX_SHARE_NAME_LEN 13
#define SHARE_INFO_1_SIZE (MAX_SHARE_NAME_LEN + sizeof (char) + \
sizeof (short) + sizeof (uint32_t))
/*
* count of bytes in server response packet
* except parameters and data. Note that setup
* word count is zero.
*/
#define RESP_HEADER_LEN 24
/*
* NB. I started by using common functions for transaction/transaction2
* and transaction_secondary/transaction2_secondary because they
* are respectively so similar. However, it turned out to be a bad
* idea because of quirky differences. Be sure if you modify one
* of these four functions to check and see if the modification should
* be applied to its peer.
*/
int
{
int rc;
char *stn;
int ready;
if (rc != 0) {
/* NOTREACHED */
}
/* NOTREACHED */
}
/* Should be some alignment stuff here in SMB? */
} else {
}
if (rc != 0) {
/* NOTREACHED */
}
/* NOTREACHED */
}
/* NOTREACHED */
}
/* NOTREACHED */
}
if (smb_xa_open(xa)) {
/* NOTREACHED */
}
if (!ready) {
return (SDRC_NORMAL_REPLY);
}
if (!smb_xa_complete(xa)) {
/* NOTREACHED */
}
}
int
{
int rc;
/* NOTREACHED */
}
/* NOTREACHED */
}
}
return (SDRC_DROP_VC);
}
if (rc != 0) {
/* NOTREACHED */
}
/* NOTREACHED */
}
/* NOTREACHED */
}
if (!smb_trans_ready(xa))
return (SDRC_NO_REPLY);
if (!smb_xa_complete(xa))
return (SDRC_NO_REPLY);
}
int
{
int rc;
if (rc != 0) {
/* NOTREACHED */
}
return (SDRC_UNIMPLEMENTED);
}
int /*ARGSUSED*/
{
return (SDRC_UNIMPLEMENTED);
}
int
{
int ready;
int rc;
if (rc != 0) {
/* NOTREACHED */
}
if (xa == 0) {
/* NOTREACHED */
}
/* NOTREACHED */
}
/* NOTREACHED */
}
/* NOTREACHED */
}
if (smb_xa_open(xa)) {
/* NOTREACHED */
}
if (!ready) {
return (SDRC_NORMAL_REPLY);
}
if (!smb_xa_complete(xa)) {
/* NOTREACHED */
}
}
int
{
int rc;
/* NOTREACHED */
}
/* NOTREACHED */
}
}
return (SDRC_DROP_VC);
}
if (rc != 0) {
/* NOTREACHED */
}
/* NOTREACHED */
}
/* NOTREACHED */
}
if (!smb_trans_ready(xa))
return (SDRC_NO_REPLY);
if (!smb_xa_complete(xa))
return (SDRC_NO_REPLY);
}
static int
{
int rc;
n_setup++;
n_param++;
case NT_TRANSACT_CREATE:
break;
break;
break;
break;
case NT_TRANSACT_IOCTL:
break;
case NT_TRANSACT_QUERY_QUOTA:
/* NOTREACHED */
case NT_TRANSACT_SET_QUOTA:
/* NOTREACHED */
default:
/* NOTREACHED */
}
switch (rc) {
case SDRC_NORMAL_REPLY:
break;
case SDRC_DROP_VC:
case SDRC_NO_REPLY:
case SDRC_ERROR_REPLY:
return (rc);
case SDRC_UNIMPLEMENTED:
case SDRC_UNSUPPORTED:
/* NOTREACHED */
default:
break;
}
/* NOTREACHED */
}
/* neato, blast it over there */
"b 3. llllllllb C w #. C #. C",
n_param, /* Total Parameter Bytes */
n_data, /* Total Data Bytes */
n_param, /* Total Parameter Bytes this buffer */
param_off, /* Param offset from header start */
0, /* Param displacement */
n_data, /* Total Data Bytes this buffer */
data_off, /* Data offset from header start */
0, /* Data displacement */
n_setup, /* suwcnt */
total_bytes, /* Total data bytes */
&xa->rep_param_mb,
&xa->rep_data_mb);
return (SDRC_NORMAL_REPLY);
}
/*
* smb_nt_transact_query_quota
*
* Stub to help debunk this function. There are 16 parameter bytes. The
* first parameter is definitely the fid. The second looks like a flags
* field. Then there are 12 bytes (probably 3 dwords) - all zero.
*/
int
{
int rc;
if (rc != 0) {
/* NOTREACHED */
}
return (SDRC_NORMAL_REPLY);
}
int
{
unsigned char MaxSetupCount, SetupCount;
int ready;
int rc;
if (rc != 0) {
/* NOTREACHED */
}
if (xa == 0) {
/* NOTREACHED */
}
xa->smb_timeout = 0;
/* NOTREACHED */
}
/* NOTREACHED */
}
/* NOTREACHED */
}
if (smb_xa_open(xa)) {
/* NOTREACHED */
}
if (!ready) {
return (SDRC_NORMAL_REPLY);
}
if (!smb_xa_complete(xa)) {
/* NOTREACHED */
}
}
int
{
int rc;
/* NOTREACHED */
}
/* NOTREACHED */
}
}
return (SDRC_DROP_VC);
}
if (rc != 0) {
/* NOTREACHED */
}
/* NOTREACHED */
}
/* NOTREACHED */
}
if (!smb_trans_ready(xa))
return (SDRC_NO_REPLY);
if (!smb_xa_complete(xa))
return (SDRC_NO_REPLY);
}
int
{
int rc;
return (rc);
}
/*
* smb_emit_SHARE_INFO_0
*
* This function will convert unicode chars to oem chars before
* and store the result in a fixed length, MAX_SHARE_NAME_LEN, buffer. If the
* length after conversion is longer than 12, -1 will be reported
* to indicate an error. The fixed length is a limitation of the
* smb protocol.
*/
static int
{
char *tmpbuf;
unsigned int cpid = oem_get_smb_cpid();
unsigned int length;
char name_buf[MAX_SHARE_NAME_LEN];
if (name == 0)
tmpbuf = "";
else
return (-1);
}
return (0);
}
static int
unsigned char *comment)
{
return (-1);
return (0);
}
static void /*ARGSUSED*/
{
unsigned char pword[9];
/*
* XXX PGD. Is there a bug here? We zero pword, copy password
* into pword then ignore it and use password for smb_encode_mbc?
*/
password);
}
/*
* is_long_sharename
*
* This function is extracted from smb_emit_SHARE_INFO_0 only for
* finding shares that their names are longer than MAX_SHARE_NAME_LEN.
*
* The function returns 1 for long share names and 0 when the length
* is Ok.
*/
static int
is_long_sharename(unsigned char *name)
{
char *tmpbuf;
unsigned int cpid = oem_get_smb_cpid();
unsigned int length;
if (name == 0)
tmpbuf = "";
else
return (1);
}
return (0);
}
/*
* This structure holds information about shares which will
* fit in the specified client buffer size.
*
* sei_bufsize: Client specified buffer size
* sei_count: Maximum number of shares that can be
* sent in the buffer.
*
* The return data section consists of a number of SHARE_INFO_1 structures.
* In case there are multiple SHARE_INFO_1 data structures to return this
* function put all fixed length part of these structures in the return buffer
* and then put all the variable length data (shares' comment) at the end of
* buffer.
*
* sei_info_len: Size of fixed length part of SHARE_INFO_1
* structures for sei_count shares
* sei_cmnt_len: Size of comments for sei_count shares
*/
typedef struct {
short sei_count;
int sei_infolen;
int sei_cmntlen;
/*
* smb_share_update_info
*
* Check to see if the given buffer has enough
* room to fit the information of the given share.
* If there is enough room update the passed max_???
* information.
*
* Return 1 if buffer is not full yet, 0 if it's full.
*/
static int
{
int cmnt_len;
cmnt_len = 1;
else
new_cmnt_len += cmnt_len;
return (1);
}
return (0);
}
/*
* smb_share_skip_share
*
* Determines whether the given share should be enumerated
* or not. The share will not be enumerated if its name is
* long or it's autohome share.
*
* Return 1 if the share should be skipped; otherwise returns
* 0
*/
static int
{
return (1);
}
/* Skip autohome share if autohome filter is enabled */
return (1);
}
return (0);
}
/*
* smb_share_add_autohome
*
* Determines if an autohome share should be added to shares' list
* for the given user.
* Autohome will be add when all the following conditions are true:
*
* 1. Autohome feature is enabled
* 2. A share with the same name as the given user exists
* 3. The share is not a permanent share
* 4. Share name is not longer than maximum allowed
*/
static int
{
int do_add = 0;
return (do_add);
}
/*
* smb_share_total_info
*
* This function calculates following informations
* - Maximum number of shares that can be sent for clients
* according to its buffer size (cli_bufsize)
* - length of fixed information about above shares
* - length of comments of above shares
* - total number of shares that their names are no longer
* than MAX_SHARE_NAME_LEN.
*
* Added SMB user object to the parameter list to filter out other
* user autohome shares.
*/
static void
{
struct lmshare_info *auto_si;
int more_room = 1;
*tot_shares_num = 0;
shr_enum_info->sei_count = 0;
shr_enum_info->sei_infolen = 0;
shr_enum_info->sei_cmntlen = 0;
(*tot_shares_num)++;
}
if (iterator == 0) {
return;
}
/* check for door errors */
(void) lmshrd_close_iterator(iterator);
return;
}
while (*si->share_name != 0) {
if (smb_share_skip_share(si)) {
/* check for door errors */
(void) lmshrd_close_iterator(iterator);
sizeof (struct lmshare_info));
return;
}
continue;
}
(*tot_shares_num)++;
if (more_room) {
}
/* check for door errors */
(void) lmshrd_close_iterator(iterator);
return;
}
}
(void) lmshrd_close_iterator(iterator);
}
/*
* smb_encode_SHARE_INFO_1
*
* This function is extracted from smb_emit_SHARE_INFO_1 and only
* encodes fixed part of SHARE_INFO_1 structure.
*
* The function returns -1 if encoding fails and 0 on success.
*/
static int
{
return (-1);
return (0);
}
/*
* collect_shares_info
*
* This function encodes information of shares_num of shares
* into data_mb and cmnt_str.
*
* Added SMB user object to the parameter list to filter out other
* user autohome shares.
*
*/
static void
struct mbuf_chain *data_mb,
{
int i = 0;
struct lmshare_info *tsi;
int is_special;
(unsigned char *)tsi->share_name,
i++;
}
}
/* check for door errors */
return;
}
if (smb_share_skip_share(si)) {
goto next;
}
/* check for door errors */
if (is_special == NERR_InternalError) {
return;
}
if (is_special) {
(unsigned char *)si->share_name,
goto next;
}
(*cmnt_len)++;
} else {
*cmnt_len) < 0) {
goto next;
}
}
next:
/* check for door errors */
return;
}
}
}
int
{
short left_shares_cnt; /* Number of shares not sent yet */
/*
* Number of shares that should be sent
* in the current response packet.
* It can be a number between 0 and
* max_share_scnt.
*/
short shares_scnt;
/*
* Maximum number of shares that can be
* sent in one response packet regarding
* the maximum negotiated buffer size
* for SMB messages.
*/
short max_shares_per_packet;
/*
* Total number of shares on the server
* that their name is not greater than
* MAX_SHARE_NAME_LEN
*/
short shares_tot_num;
/*
* Size of total data (info + cmnt)
* that should be sent for client
*/
int shares_tot_byte;
/*
* Maximum size of data that can be
* sent in one SMB transaction response
* according to the maximum negotiated
* buffer size for SMB packets
*/
int data_buf_limit;
/*
* Number of comment bytes that will
* be sent in the current response
*/
/*
* Number of data bytes that will
* be sent in the current response
*/
/*
* Total number of data bytes that
* are sent till now. This is only
* used for calculating current data
* displacement
*/
/*
* Number of parameter bytes should
* be sent for the current response.
* It is 8 for the 1st response and
* 0 for others
*/
/* number of setup and parameter bytes */
/* data and parameter displacement */
/* return status by the 1st reply */
/* parameter and data offset and pad */
/*
* total bytes of parameters and data
* in the packet, plus the pad bytes.
*/
int tot_packet_bytes;
char first_resp;
unsigned char *r_fmt;
char fmt[10];
char *cmnt_str, *cmnt_start;
int cmnt_len;
struct mbuf_chain reply;
/*
* Initialize the mbuf chain of reply to zero. If it is not
* zero, code inside the while loop will try to free the chain.
*/
return (SDRC_UNSUPPORTED);
if (level != 1) {
NERR_BadTransactConfig, 0, 0, 0);
return (SDRC_NORMAL_REPLY);
}
n_setup = 0; /* Setup count for NetShareEnum SMB is 0 */
n_param = 8;
/* Check buffer to have enough space */
if (shares_tot_byte == 0) {
return (SDRC_ERROR_REPLY);
}
cmnt_len = 0;
/* save start of buffer to free it at the end of function */
return (SDRC_DROP_VC);
}
/*
* The rep_setup_mb is already initialized in smb_trans_dispatch().
* Calling MBC_INIT() will initialized the structure and so the
* pointer to the mbuf chains will be lost. Therefore, we need
* to free the resources before calling MBC_INIT() again.
*/
tot_data_scnt = 0;
cmnt_scnt = 0;
first_resp = 1;
while (tot_data_scnt < shares_tot_byte) {
/*
* Calling MBC_INIT() will initialized the structure and so the
* pointer to the mbuf chains will be lost. Therefore, we need
* to free the resources if any before calling MBC_INIT().
*/
if (left_shares_cnt == 0) {
/*
* Now send comments.
* Append comments to the end of share_info_1
* structures.
*/
/*LINTED E_ASSIGN_NARROW_CONV*/
}
}
/* Only the 1st response packet contains parameters */
/*
* Calling MBC_INIT() will initialized the structure and so the
* pointer to the mbuf chains will be lost. Therefore, we need
* to free the resources if any before calling MBC_INIT().
*/
if (first_resp) {
first_resp = 0;
/* Prepare parameters for the 1st response packet */
? ERROR_MORE_DATA : 0;
}
/* data off from hdr start */
/*
* Calling MBC_INIT() will initialized the structure and so the
* pointer to the mbuf chains will be lost. Therefore, we need
* to free the resources if any before calling MBC_INIT().
*/
+ sizeof (uchar_t) /* word parameters count */
+ sizeof (ushort_t) /* total data byte count */
+ tot_packet_bytes);
(void) smb_encode_mbc(&reply,
"b ww 2. www www b . C w #. C #. C",
n_param, /* Total Parameter Bytes */
shares_tot_byte, /* Total Data Bytes */
param_scnt, /* Total Parameter Bytes this buffer */
param_off, /* Param offset from header start */
param_disp, /* Param displacement */
data_scnt, /* Total Data Bytes this buffer */
data_off, /* Data offset from header start */
data_disp, /* Data displacement */
n_setup, /* suwcnt */
tot_packet_bytes, /* Total data bytes */
&xa->rep_param_mb,
&xa->rep_data_mb);
}
(void) lmshrd_close_iterator(iterator);
return (SDRC_NO_REPLY);
}
int
{
unsigned char *req_fmt;
unsigned char *rep_fmt;
struct mbuf_chain str_mb;
char *share;
char *path;
char *password;
char *comment;
int shr_found;
return (SDRC_UNSUPPORTED);
(void) utf8_strlwr(share);
path = "";
password = "";
} else if (shr_found) {
type |= STYPE_HIDDEN;
password = "";
} else {
/* We have no idea what this share is... */
NERR_NetNameNotFound, 0, 0);
return (SDRC_NORMAL_REPLY);
}
if (shr_found)
else
comment = "";
password = "";
switch (level) {
case 0 :
(unsigned char *)share);
break;
case 1 :
(unsigned char *)comment);
break;
case 2 :
default:
return (SDRC_UNSUPPORTED);
}
return (SDRC_NORMAL_REPLY);
}
int
{
unsigned char *req_fmt;
unsigned char *rep_fmt;
struct mbuf_chain str_mb;
char *domain;
char *hostname;
(level != 10)) {
NERR_BadTransactConfig, 0, 0, 0);
return (SDRC_NORMAL_REPLY);
}
return (SDRC_NORMAL_REPLY);
}
int
{
unsigned char *req_fmt;
unsigned char *rep_fmt;
unsigned char *user;
int rc;
&opcode,
&req_fmt,
&rep_fmt,
&user,
&level,
&max_bytes);
if (rc != 0)
return (SDRC_UNSUPPORTED);
NERR_UserNotFound, 0, 0);
return (SDRC_NORMAL_REPLY);
}
int
{
char *req_fmt;
char *rep_fmt;
char server_name[16];
struct mbuf_chain str_mb;
char *hostname;
char *comment;
/* NOTREACHED */
}
switch (level) {
case 0:
break;
case 1:
break;
case 2:
/* B16BBDzDDDWWzWWWWWWWB21BzWWWWWWWWWWWWWWWWWWWWWWz */
/* B16BBDz */
(uint32_t)1,
(uint32_t)2,
(uint32_t)3,
(uint16_t)4,
(uint16_t)5,
MBC_LENGTH(&str_mb));
(uint16_t)6,
(uint16_t)7,
(uint16_t)8,
(uint16_t)9,
(uint16_t)10,
(uint16_t)11,
(uint16_t)12,
"21 byte comment ",
(unsigned char)13,
MBC_LENGTH(&str_mb));
"wwwwwwwwwwwwwwwwwwwwwwl",
(uint16_t)14,
(uint16_t)15,
(uint16_t)16,
(uint16_t)17,
(uint16_t)18,
(uint16_t)19,
(uint16_t)20,
(uint16_t)21,
(uint16_t)22,
(uint16_t)23,
(uint16_t)24,
(uint16_t)25,
(uint16_t)26,
(uint16_t)27,
(uint16_t)28,
(uint16_t)29,
(uint16_t)20,
(uint16_t)31,
(uint16_t)32,
(uint16_t)33,
(uint16_t)34,
(uint16_t)35,
MBC_LENGTH(&str_mb));
break;
default:
return (SDRC_UNSUPPORTED);
}
(MBC_LENGTH(&str_mb)));
return (SDRC_NORMAL_REPLY);
}
/*
* 6.4 The NetServerEnum2 RAP Service
*
* The NetServerEnum2 RAP service lists all computers of the specified type
* or types that are visible in the specified domains. It may also
* enumerate domains.
*
* The following definition uses the notation and terminology defined in
* the CIFS Remote Administration Protocol specification, which is required
* in order to make it well-defined. The definition is:
*
* uint16_t NetServerEnum2 (
* uint16_t sLevel,
* RCVBUF pbBuffer,
* RCVBUFLEN cbBuffer,
* ENTCOUNT pcEntriesRead,
* uint16_t *pcTotalAvail,
* uint32_t fServerType,
* char *pszDomain,
* );
*
* where:
*
* sLevel specifies the level of detail (0 or 1) requested.
*
* pbBuffer points to the buffer to receive the returned data. If the
* function is successful, the buffer contains a sequence of
* server_info_x structures, where x is 0 or 1, depending on the
* level of detail requested.
*
* cbBuffer specifies the size, in bytes, of the buffer pointed to by
* the pbBuffer parameter.
*
* pcEntriesRead points to a 16 bit variable that receives a count of
* the number of servers enumerated in the buffer. This count is
* valid only if NetServerEnum2 returns the NERR_Success or
* ERROR_MORE_DATA values.
*
* pcTotal Avail points to a 16 bit variable that receives a count of
* the total number of available entries. This count is valid only if
* NetServerEnum2 returns the NERR_Success or ERROR_MORE_DATA values.
*
* fServerType specifies the type or types of computers to enumerate.
* Computers that match at least one of the specified types are
* returned in the buffer. Possible values are defined in the request
* parameters section.
*
* pszDomain points to a null-terminated string that contains the
* name of the workgroup in which to enumerate computers of the
* specified type or types. If the pszDomain parameter is a null
* string or a null pointer, servers are enumerated for the current
* domain of the computer.
*
* 6.4.1 Transaction Request Parameters section
*
* The Transaction request parameters section in this instance contains:
* . The 16 bit function number for NetServerEnum2 which is 104.
* . The parameter descriptor string which is "WrLehDz".
* . The data descriptor string for the (returned) data which is "B16" for
* level detail 0 or "B16BBDz" for level detail 1.
* . The actual parameters as described by the parameter descriptor
* string.
*
* The parameters are:
* . A 16 bit integer with a value of 0 or 1 (corresponding to the "W" in
* the parameter descriptor string. This represents the level of detail
* the server is expected to return
* . A 16 bit integer that contains the size of the receive buffer.
* . A 32 bit integer that represents the type of servers the function
* should enumerate. The possible values may be any of the following or
* a combination of the following:
*
* SV_TYPE_WORKSTATION 0x00000001 All workstations
* SV_TYPE_SERVER 0x00000002 All servers
* SV_TYPE_SQLSERVER 0x00000004 Any server running with SQL
* server
* SV_TYPE_DOMAIN_CTRL 0x00000008 Primary domain controller
* SV_TYPE_DOMAIN_BAKCTRL 0x00000010 Backup domain controller
* SV_TYPE_TIME_SOURCE 0x00000020 Server running the timesource
* service
* SV_TYPE_AFP 0x00000040 Apple File Protocol servers
* SV_TYPE_NOVELL 0x00000080 Novell servers
* SV_TYPE_DOMAIN_MEMBER 0x00000100 Domain Member
* SV_TYPE_PRINTQ_SERVER 0x00000200 Server sharing print queue
* SV_TYPE_DIALIN_SERVER 0x00000400 Server running dialin service.
* SV_TYPE_XENIX_SERVER 0x00000800 Xenix server
* SV_TYPE_NT 0x00001000 NT server
* SV_TYPE_WFW 0x00002000 Server running Windows for
* Workgroups
* SV_TYPE_SERVER_NT 0x00008000 Windows NT non DC server
* SV_TYPE_POTENTIAL_BROWSER 0x00010000 Server that can run the browser
* service
* SV_TYPE_BACKUP_BROWSER 0x00020000 Backup browser server
* SV_TYPE_MASTER_BROWSER 0x00040000 Master browser server
* SV_TYPE_DOMAIN_MASTER 0x00080000 Domain Master Browser server
* SV_TYPE_LOCAL_LIST_ONLY 0x40000000 Enumerate only entries marked
* "local"
* SV_TYPE_DOMAIN_ENUM 0x80000000 Enumerate Domains. The pszDomain
* parameter must be NULL.
*
* . A null terminated ASCII string representing the pszDomain parameter
* described above
*
* 6.4.2 Transaction Request Data section
*
* There is no data or auxiliary data to send as part of the request.
*
* 6.4.3 Transaction Response Parameters section
*
* The transaction response parameters section consists of:
* . A 16 bit word indicating the return status. The possible values are:
*
* Code Value Description
* NERR_Success 0 No errors encountered
* ERROR_MORE_DATA 234 Additional data is available
* NERR_ServerNotStarted 2114 The RAP service on the remote computer
* is not running
* NERR_BadTransactConfig 2141 The server is not configured for
* transactions, IPC$ is not shared
*
* . A 16 bit "converter" word.
* . A 16 bit number representing the number of entries returned.
* . A 16 bit number representing the total number of available entries.
* If the supplied buffer is large enough, this will equal the number of
* entries returned.
*
* 6.4.4 Transaction Response Data section
*
* The return data section consists of a number of SERVER_INFO_1 structures.
* The number of such structures present is determined by the third entry
* (described above) in the return parameters section.
*
* At level detail 0, the Transaction response data section contains a
* number of SERVER_INFO_0 data structure. The number of such structures is
* equal to the 16 bit number returned by the server in the third parameter
* in the Transaction response parameter section. The SERVER_INFO_0 data
* structure is defined as:
*
* struct SERVER_INFO_0 {
* char sv0_name[16];
* };
*
* where:
*
* sv0_name is a null-terminated string that specifies the name of a
* computer or domain .
*
* At level detail 1, the Transaction response data section contains a
* number of SERVER_INFO_1 data structure. The number of such structures is
* equal to the 16 bit number returned by the server in the third parameter
* in the Transaction response parameter section. The SERVER_INFO_1 data
* structure is defined as:
*
* struct SERVER_INFO_1 {
* char sv1_name[16];
* char sv1_version_major;
* char sv1_version_minor;
* uint32_t sv1_type;
* char *sv1_comment_or_master_browser;
* };
*
* sv1_name contains a null-terminated string that specifies the name
* of a computer, or a domain name if SV_TYPE_DOMAIN_ENUM is set in
* sv1_type.
*
* sv1_version_major whatever was specified in the HostAnnouncement
* or DomainAnnouncement frame with which the entry was registered.
*
* sv1_version_minor whatever was specified in the HostAnnouncement
* or DomainAnnouncement frame with which the entry was registered.
*
* sv1_type specifies the type of software the computer is running.
* The member can be one or a combination of the values defined above
* in the Transaction request parameters section for fServerType.
*
*
* sv1_comment_or_master_browser points to a null-terminated string. If
* the sv1_type indicates that the entry is for a domain, this
* specifies the name of server running the domain master browser;
* otherwise, it specifies a comment describing the server. The comment
* can be a null string or the pointer may be a null pointer.
*
* In case there are multiple SERVER_INFO_1 data structures to
* return, the server may put all these fixed length structures in
* the return buffer, leave some space and then put all the variable
* length data (the actual value of the sv1_comment strings) at the
* end of the buffer.
*
* There is no auxiliary data to receive.
*/
int
{
unsigned char *domain;
struct mbuf_chain str_mb;
char *hostname, *s;
return (SDRC_UNSUPPORTED);
return (SDRC_NORMAL_REPLY);
}
if ((server_type & MY_SERVER_TYPE) == 0) {
return (SDRC_NORMAL_REPLY);
}
if (level == 1) {
}
return (SDRC_NORMAL_REPLY);
}
/*
* is_supported_pipe
*
* Currently, just return 0 if the pipe is \\PIPE\repl otherwise
* return 1.
*/
int
is_supported_pipe(char *pname)
{
return (0);
return (1);
}
int
{
char *req_fmt;
char *rep_fmt;
struct vardata_block vdb;
n_setup++;
n_param++;
if (rc != 0)
goto trans_err_not_supported;
switch (opcode) {
case TRANS_SET_NMPIPE_STATE:
&devstate)) != 0)
goto trans_err_not_supported;
break;
case TRANS_TRANSACT_NMPIPE:
/* NOTREACHED */
}
if (rc != 0)
goto trans_err_not_supported;
break;
case TRANS_WAIT_NMPIPE:
/* NOT REACHED */
}
break;
default:
goto trans_err_not_supported;
}
} else {
PIPE_LANMAN) != 0) &&
goto trans_err_not_supported;
goto trans_err_not_supported;
/* for now, only respond to the */
switch (opcode) {
case API_WshareEnum:
break;
case API_WshareGetInfo:
break;
case API_WserverGetInfo:
break;
case API_WUserGetInfo:
break;
case API_WWkstaGetInfo:
break;
case API_NetServerEnum2:
break;
default:
goto trans_err_not_supported;
}
}
switch (rc) {
case SDRC_NORMAL_REPLY:
break;
case SDRC_DROP_VC:
case SDRC_NO_REPLY:
case SDRC_ERROR_REPLY:
return (rc);
case SDRC_UNIMPLEMENTED:
case SDRC_UNSUPPORTED:
goto trans_err_not_supported;
default:
break;
}
goto trans_err_too_small;
}
/* neato, blast it over there */
/* Param off from hdr start */
"b ww 2. www www b . C w #. C #. C",
n_param, /* Total Parameter Bytes */
n_data, /* Total Data Bytes */
n_param, /* Total Parameter Bytes this buffer */
param_off, /* Param offset from header start */
0, /* Param displacement */
n_data, /* Total Data Bytes this buffer */
data_off, /* Data offset from header start */
0, /* Data displacement */
n_setup, /* suwcnt */
total_bytes, /* Total data bytes */
&xa->rep_param_mb,
&xa->rep_data_mb);
return (SDRC_NORMAL_REPLY);
goto trans_err;
goto trans_err;
10, /* wct */
4, 0, /* tpscnt tdscnt */
0, 0, 0, /* dscnt dsoff dsdisp */
0, /* suwcnt */
4, /* bcc */
rc,
0); /* converter word? */
return (SDRC_NORMAL_REPLY);
}
int
{
char *fmt;
n_setup++;
n_param++;
goto trans_err_not_supported;
/*
* Save this for /proc to read later.
*/
/* for now, only respond to the */
switch (opcode) {
case TRANS2_CREATE_DIRECTORY:
break;
case TRANS2_FIND_FIRST2:
/*
* Should have enough room to send the response
* data back to client.
*/
if (n_data == 0) {
/* NOT REACHED */
}
break;
case TRANS2_FIND_NEXT2:
/*
* Should have enough room to send the response
* data back to client.
*/
if (n_data == 0) {
/* NOT REACHED */
}
break;
/*
* Should have enough room to send the response
* data back to client.
*/
if (n_data == 0) {
/* NOT REACHED */
}
break;
/*
* Should have enough room to send the response
* data back to client.
*/
if (n_data == 0) {
/* NOT REACHED */
}
break;
/*
* Should have enough room to send the response
* data back to client.
*/
if (n_data == 0) {
/* NOT REACHED */
}
break;
break;
break;
default:
goto trans_err_not_supported;
}
switch (rc) {
case SDRC_NORMAL_REPLY:
break;
case SDRC_DROP_VC:
case SDRC_NO_REPLY:
case SDRC_ERROR_REPLY:
return (rc);
case SDRC_UNIMPLEMENTED:
case SDRC_UNSUPPORTED:
goto trans_err_not_supported;
default:
break;
}
goto trans_err_too_small;
}
/* neato, blast it over there */
/*
* Including the nt_unknown_secret value persuades netmon to
* display the correct data format for QueryPathInfo and
* QueryFileInfo.
*/
if (opcode == TRANS2_QUERY_FILE_INFORMATION ||
fmt = "b ww 2. www www b . C w #. C w C";
nt_unknown_secret = 0x0100;
}
else
{
/* Param off from hdr start */
fmt = "b ww 2. www www b . C w #. C #. C";
/*LINTED E_ASSIGN_NARROW_CONV*/
}
fmt,
n_param, /* Total Parameter Bytes */
n_param, /* Total Parameter Bytes this buffer */
param_off, /* Param offset from header start */
0, /* Param displacement */
data_off, /* Data offset from header start */
0, /* Data displacement */
n_setup, /* suwcnt */
total_bytes, /* Total data bytes */
&xa->rep_param_mb,
&xa->rep_data_mb);
return (SDRC_NORMAL_REPLY);
goto trans_err;
goto trans_err;
10, /* wct */
4, 0, /* tpscnt tdscnt */
0, 0, 0, /* dscnt dsoff dsdisp */
0, /* suwcnt */
4, /* bcc */
rc,
0); /* converter word? */
return (SDRC_NORMAL_REPLY);
}
smb_xa_t *
{
/*
* The new xa structure is checked against the current list to see
* if it exists already.
*/
while (nxa) {
!SMB_XA_CLOSED(nxa) &&
return (NULL);
}
}
return (xa);
}
void
{
if (xa->xa_smb_trans_name)
}
smb_xa_t *
{
return (xa);
}
void
{
return;
}
}
int
{
int rc;
rc = 0;
} else {
}
return (rc);
}
void
{
return;
}
}
int
{
int rc;
rc = 0;
} else {
rc = 1;
}
return (rc);
}
smb_xa_t *
{
while (xa) {
!SMB_XA_CLOSED(xa) &&
break;
}
}
return (xa);
}