da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER START
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The contents of this file are subject to the terms of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Common Development and Distribution License (the "License").
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You may not use this file except in compliance with the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * See the License for the specific language governing permissions
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and limitations under the License.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * When distributing Covered Code, include this CDDL HEADER in each
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If applicable, add the following below this CDDL HEADER, with the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * fields enclosed by brackets "[]" replaced with your own identifying
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * information: Portions Copyright [yyyy] [name of copyright owner]
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * CDDL HEADER END
c586600796766c83eb9485c446886fd9ed2359a9Keyur Desai * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
68b2bbf26c7040fea4281dcb58b81e7627e46f34Gordon Ross * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * count of bytes in server response packet
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * except parameters and data. Note that setup
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * word count is zero.
b1352070d318187b41b088da3533692976f3f225Alan Wright * We started by using common functions for transaction/transaction2
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * and transaction_secondary/transaction2_secondary because they
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * are respectively so similar. However, it turned out to be a bad
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * idea because of quirky differences. Be sure if you modify one
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * of these four functions to check and see if the modification should
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * be applied to its peer.
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesstatic int smb_trans_ready(smb_xa_t *);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesstatic smb_sdrc_t smb_trans_dispatch(smb_request_t *, smb_xa_t *);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statesstatic smb_sdrc_t smb_trans2_dispatch(smb_request_t *, smb_xa_t *);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__Transaction__start, smb_request_t *, sr);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__Transaction__done, smb_request_t *, sr);
7b59d02d2a384be9a08087b14defadd214b3c1ddjb if (rc != 0)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw xa = smb_xa_create(sr->session, sr, tpscnt, tdscnt, mprcnt, mdrcnt,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* Should be some alignment stuff here in SMB? */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (rc != 0) {
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States xa->xa_pipe_name = smb_mem_strdup(stn);
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_setup_mb, &sr->smb_vwv,
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_param_mb, &sr->command, psoff, pscnt)) {
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_data_mb, &sr->command, dsoff, dscnt)) {
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__TransactionSecondary__start, smb_request_t *, sr);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__TransactionSecondary__done, smb_request_t *, sr);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (smb_sign_check_secondary(sr, xa->reply_seqnum) != 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw rc = smbsr_decode_vwv(sr, SMB_TRANSSHDR_ED_FMT, &tpscnt, &tdscnt,
7b59d02d2a384be9a08087b14defadd214b3c1ddjb if (rc != 0)
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * The words psdisp, dsdisp, tell us what displacement
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * into the entire trans parameter and data buffers
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * where we should put the params & data that are
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * delivered by this request. [MS-CIFS] says all the
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * parameters and data SHOULD be sent sequentially, so
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * so we can normally reassemble by simply appending.
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * However, the components MAY come out of order, so
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * check and set the current offset. This is rare,
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * and we might like to know when this happens, so
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * fire some static dtrace probes when it does.
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_param_mb, &sr->command, psoff, pscnt)) {
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_data_mb, &sr->command, dsoff, dscnt)) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw uint16_t fid, category, function, tpscnt, tdscnt, mprcnt;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw rc = smbsr_decode_vwv(sr, "wwwwwwwl2.wwww", &fid, &category, &function,
7b59d02d2a384be9a08087b14defadd214b3c1ddjb if (rc != 0)
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__Transaction2__start, smb_request_t *, sr);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__Transaction2__done, smb_request_t *, sr);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw rc = smbsr_decode_vwv(sr, SMB_TRANSHDR_ED_FMT, &tpscnt, &tdscnt,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw &mprcnt, &mdrcnt, &msrcnt, &flags, &timeo, &pscnt, &psoff, &dscnt,
7b59d02d2a384be9a08087b14defadd214b3c1ddjb if (rc != 0)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw xa = smb_xa_create(sr->session, sr, tpscnt, tdscnt, mprcnt, mdrcnt,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (xa == 0) {
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_setup_mb, &sr->smb_vwv,
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_param_mb, &sr->command, psoff, pscnt)) {
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_data_mb, &sr->command, dsoff, dscnt)) {
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__Transaction2Secondary__start, smb_request_t *, sr);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__Transaction2Secondary__done, smb_request_t *, sr);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (smb_sign_check_secondary(sr, xa->reply_seqnum) != 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw rc = smbsr_decode_vwv(sr, SMB_TRANS2SHDR_ED_FMT, &tpscnt, &tdscnt,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw &pscnt, &psoff, &psdisp, &dscnt, &dsoff, &dsdisp, &fid);
7b59d02d2a384be9a08087b14defadd214b3c1ddjb if (rc != 0)
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * See comment in smb_com_transaction_secondary
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_param_mb, &sr->command, psoff, pscnt)) {
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_data_mb, &sr->command, dsoff, dscnt)) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwsmb_nt_trans_dispatch(struct smb_request *sr, struct smb_xa *xa)
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States rc = smb_nt_transact_query_quota(sr, xa);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States rc = smb_nt_transact_set_quota(sr, xa);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States break;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw switch (rc) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* neato, blast it over there */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw n_setup = (n_setup + 1) / 2; /* Conver to setup words */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw data_pad = (4 - ((param_off + n_param) & 3)) % 4; /* Pad to 4 byte */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw data_off = param_off + n_param + data_pad; /* Param off from hdr */
3db3f65c6274eb042354801a308c8e9bc4994553amw "b3.llllllllbCw#.C#.C",
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, /* Param displacement */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, /* Data displacement */
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__NtTransact__start, smb_request_t *, sr);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw rc = smbsr_decode_vwv(sr, SMB_NT_TRANSHDR_ED_FMT, &MaxSetupCount,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw &TotalParameterCount, &TotalDataCount, &MaxParameterCount,
7b59d02d2a384be9a08087b14defadd214b3c1ddjb if (rc != 0)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw xa = smb_xa_create(sr->session, sr, TotalParameterCount, TotalDataCount,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw MaxParameterCount, MaxDataCount, MaxSetupCount, SetupCount);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (xa == 0) {
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_setup_mb, &sr->smb_vwv,
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_param_mb, &sr->command, psoff, pscnt)) {
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_data_mb, &sr->command, dsoff, dscnt)) {
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__NtTransactSecondary__start, smb_request_t *, sr);
faa1795a28a5c712eed6d0a3f84d98c368a316c6jb DTRACE_SMB_1(op__NtTransactSecondary__done, smb_request_t *, sr);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (smb_sign_check_secondary(sr, xa->reply_seqnum) != 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw rc = smbsr_decode_vwv(sr, SMB_TRANS2SHDR_ED_FMT, &tpscnt, &tdscnt,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw &pscnt, &psoff, &psdisp, &dscnt, &dsoff, &dsdisp, &fid);
7b59d02d2a384be9a08087b14defadd214b3c1ddjb if (rc != 0)
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * See comment in smb_com_transaction_secondary
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_param_mb, &sr->command, psoff, pscnt)) {
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (smb_mbc_copy(&xa->req_data_mb, &sr->command, dsoff, dscnt)) {
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statessmb_trans_ready(smb_xa_t *xa)
3ad684d66b78e06edd37e2c4fd3b3949f095194bjbstatic void
3ad684d66b78e06edd37e2c4fd3b3949f095194bjbsmb_encode_SHARE_INFO_1(struct mbuf_chain *output, struct mbuf_chain *text,
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(text, "s", comment ? comment : "");
3ad684d66b78e06edd37e2c4fd3b3949f095194bjbstatic void
3ad684d66b78e06edd37e2c4fd3b3949f095194bjbsmb_encode_SHARE_INFO_2(struct mbuf_chain *output, struct mbuf_chain *text,
3ad684d66b78e06edd37e2c4fd3b3949f095194bjb char *comment, uint16_t access, char *path, char *password)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw (void) strncpy((char *)pword, password, sizeof (pword));
3ad684d66b78e06edd37e2c4fd3b3949f095194bjb smb_encode_SHARE_INFO_1(output, text, oem_name, type, comment);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwsmb_trans_net_share_enum(struct smb_request *sr, struct smb_xa *xa)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Number of data bytes that will
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * be sent in the current response
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Total number of data bytes that
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * are sent till now. This is only
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * used for calculating current data
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * displacement
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Number of parameter bytes should
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * be sent for the current response.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * It is 8 for the 1st response and
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 0 for others
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* number of setup and parameter bytes */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* data and parameter displacement */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* parameter and data offset and pad */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * total bytes of parameters and data
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * in the packet, plus the pad bytes.
3ad684d66b78e06edd37e2c4fd3b3949f095194bjb * Only level 1 is valid for NetShareEnum
3ad684d66b78e06edd37e2c4fd3b3949f095194bjb * None of the error codes in the spec are meaningful
3ad684d66b78e06edd37e2c4fd3b3949f095194bjb * here. This error code is returned by Windows.
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright esi.es_buf = smb_srm_zalloc(sr, esi.es_bufsize);
c586600796766c83eb9485c446886fd9ed2359a9Keyur Desai esi.es_posix_uid = crgetuid(sr->uid_user->u_cred);
3ad684d66b78e06edd37e2c4fd3b3949f095194bjb /* client buffer size is not big enough to hold any shares */
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * Initialize the reply mbuf chain. Note that we re-initialize
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * this on each pass through the loop below.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The rep_setup_mb is already initialized in smb_trans_dispatch().
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Calling MBC_INIT() will initialized the structure and so the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * pointer to the mbuf chains will be lost. Therefore, we need
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * to free the resources before calling MBC_INIT() again.
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_data_mb, fmt, sent_buf);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* Only the 1st response packet contains parameters */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw data_pad = (param_off + n_param) & 1; /* Pad to short */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* data off from hdr start */
3db3f65c6274eb042354801a308c8e9bc4994553amw "bww2.wwwwwwb.Cw#.C#.C",
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States smb_sign_reply(sr, &reply);
3ad684d66b78e06edd37e2c4fd3b3949f095194bjbsmb_trans_net_share_getinfo(smb_request_t *sr, struct smb_xa *xa)
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright if ((si == NULL) || (si->shr_oemname == NULL)) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw switch (level) {
148c5f43199ca0b43fc8e3b643aab11cd66ea327Alan Wright si->shr_oemname, si->shr_type, si->shr_cmnt, access,
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_param_mb, "www", NERR_Success,
3ad684d66b78e06edd37e2c4fd3b3949f095194bjbsmb_trans_net_workstation_getinfo(struct smb_request *sr, struct smb_xa *xa)
b89a8333f5e1f75ec0c269b22524bd2eccb972banatalie li - Sun Microsystems - Irvine United States domain = sr->sr_cfg->skc_nbdomain;
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&str_mb, "."); /* Prevent NULL pointers */
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_data_mb, "l", MBC_LENGTH(&str_mb));
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_data_mb, "l", MBC_LENGTH(&str_mb));
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_data_mb, "l", MBC_LENGTH(&str_mb));
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States MBC_LENGTH(&str_mb));
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_data_mb, "l", MBC_LENGTH(&str_mb));
3ad684d66b78e06edd37e2c4fd3b3949f095194bjbsmb_trans_net_user_getinfo(struct smb_request *sr, struct smb_xa *xa)
3ad684d66b78e06edd37e2c4fd3b3949f095194bjbsmb_trans_net_server_getinfo(struct smb_request *sr, struct smb_xa *xa)
3db3f65c6274eb042354801a308c8e9bc4994553amw if (smb_mbc_decodef(&xa->req_param_mb, "ww", &level, &buf_size) != 0)
3ad684d66b78e06edd37e2c4fd3b3949f095194bjb /* valid levels are 0 and 1 */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw switch (level) {
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_data_mb, "16c", server_name);
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_data_mb, "16cbbll", server_name,
3ad684d66b78e06edd37e2c4fd3b3949f095194bjb avail_data = MBC_LENGTH(&xa->rep_data_mb) + MBC_LENGTH(&str_mb);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 6.4 The NetServerEnum2 RAP Service
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The NetServerEnum2 RAP service lists all computers of the specified type
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * or types that are visible in the specified domains. It may also
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * enumerate domains.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The following definition uses the notation and terminology defined in
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the CIFS Remote Administration Protocol specification, which is required
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * in order to make it well-defined. The definition is:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * uint16_t NetServerEnum2 (
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * uint16_t sLevel,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * RCVBUF pbBuffer,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * RCVBUFLEN cbBuffer,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ENTCOUNT pcEntriesRead,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * uint16_t *pcTotalAvail,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * uint32_t fServerType,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * char *pszDomain,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * sLevel specifies the level of detail (0 or 1) requested.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * pbBuffer points to the buffer to receive the returned data. If the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * function is successful, the buffer contains a sequence of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * server_info_x structures, where x is 0 or 1, depending on the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * level of detail requested.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * cbBuffer specifies the size, in bytes, of the buffer pointed to by
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the pbBuffer parameter.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * pcEntriesRead points to a 16 bit variable that receives a count of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the number of servers enumerated in the buffer. This count is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * valid only if NetServerEnum2 returns the NERR_Success or
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ERROR_MORE_DATA values.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * pcTotal Avail points to a 16 bit variable that receives a count of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the total number of available entries. This count is valid only if
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * NetServerEnum2 returns the NERR_Success or ERROR_MORE_DATA values.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * fServerType specifies the type or types of computers to enumerate.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Computers that match at least one of the specified types are
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * returned in the buffer. Possible values are defined in the request
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * parameters section.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * pszDomain points to a null-terminated string that contains the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * name of the workgroup in which to enumerate computers of the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * specified type or types. If the pszDomain parameter is a null
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * string or a null pointer, servers are enumerated for the current
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * domain of the computer.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 6.4.1 Transaction Request Parameters section
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The Transaction request parameters section in this instance contains:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . The 16 bit function number for NetServerEnum2 which is 104.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . The parameter descriptor string which is "WrLehDz".
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . The data descriptor string for the (returned) data which is "B16" for
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * level detail 0 or "B16BBDz" for level detail 1.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . The actual parameters as described by the parameter descriptor
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The parameters are:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . A 16 bit integer with a value of 0 or 1 (corresponding to the "W" in
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the parameter descriptor string. This represents the level of detail
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the server is expected to return
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . A 16 bit integer that contains the size of the receive buffer.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . A 32 bit integer that represents the type of servers the function
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * should enumerate. The possible values may be any of the following or
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * a combination of the following:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_WORKSTATION 0x00000001 All workstations
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_SERVER 0x00000002 All servers
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_SQLSERVER 0x00000004 Any server running with SQL
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_DOMAIN_CTRL 0x00000008 Primary domain controller
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_DOMAIN_BAKCTRL 0x00000010 Backup domain controller
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_TIME_SOURCE 0x00000020 Server running the timesource
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_AFP 0x00000040 Apple File Protocol servers
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_NOVELL 0x00000080 Novell servers
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_DOMAIN_MEMBER 0x00000100 Domain Member
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_PRINTQ_SERVER 0x00000200 Server sharing print queue
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_DIALIN_SERVER 0x00000400 Server running dialin service.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_XENIX_SERVER 0x00000800 Xenix server
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_NT 0x00001000 NT server
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_WFW 0x00002000 Server running Windows for
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Workgroups
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_SERVER_NT 0x00008000 Windows NT non DC server
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_POTENTIAL_BROWSER 0x00010000 Server that can run the browser
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_BACKUP_BROWSER 0x00020000 Backup browser server
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_MASTER_BROWSER 0x00040000 Master browser server
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_DOMAIN_MASTER 0x00080000 Domain Master Browser server
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_LOCAL_LIST_ONLY 0x40000000 Enumerate only entries marked
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * SV_TYPE_DOMAIN_ENUM 0x80000000 Enumerate Domains. The pszDomain
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * parameter must be NULL.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . A null terminated ASCII string representing the pszDomain parameter
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * described above
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 6.4.2 Transaction Request Data section
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * There is no data or auxiliary data to send as part of the request.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 6.4.3 Transaction Response Parameters section
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The transaction response parameters section consists of:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . A 16 bit word indicating the return status. The possible values are:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Code Value Description
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * NERR_Success 0 No errors encountered
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * ERROR_MORE_DATA 234 Additional data is available
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * NERR_ServerNotStarted 2114 The RAP service on the remote computer
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * is not running
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * NERR_BadTransactConfig 2141 The server is not configured for
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * transactions, IPC$ is not shared
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . A 16 bit "converter" word.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . A 16 bit number representing the number of entries returned.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * . A 16 bit number representing the total number of available entries.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * If the supplied buffer is large enough, this will equal the number of
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * entries returned.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * 6.4.4 Transaction Response Data section
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The return data section consists of a number of SERVER_INFO_1 structures.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The number of such structures present is determined by the third entry
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * (described above) in the return parameters section.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * At level detail 0, the Transaction response data section contains a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * number of SERVER_INFO_0 data structure. The number of such structures is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * equal to the 16 bit number returned by the server in the third parameter
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * in the Transaction response parameter section. The SERVER_INFO_0 data
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * structure is defined as:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * struct SERVER_INFO_0 {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * char sv0_name[16];
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * sv0_name is a null-terminated string that specifies the name of a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * computer or domain .
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * At level detail 1, the Transaction response data section contains a
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * number of SERVER_INFO_1 data structure. The number of such structures is
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * equal to the 16 bit number returned by the server in the third parameter
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * in the Transaction response parameter section. The SERVER_INFO_1 data
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * structure is defined as:
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * struct SERVER_INFO_1 {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * char sv1_name[16];
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * char sv1_version_major;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * char sv1_version_minor;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * uint32_t sv1_type;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * char *sv1_comment_or_master_browser;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * sv1_name contains a null-terminated string that specifies the name
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * of a computer, or a domain name if SV_TYPE_DOMAIN_ENUM is set in
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * sv1_type.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * sv1_version_major whatever was specified in the HostAnnouncement
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * or DomainAnnouncement frame with which the entry was registered.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * sv1_version_minor whatever was specified in the HostAnnouncement
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * or DomainAnnouncement frame with which the entry was registered.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * sv1_type specifies the type of software the computer is running.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The member can be one or a combination of the values defined above
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * in the Transaction request parameters section for fServerType.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * sv1_comment_or_master_browser points to a null-terminated string. If
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the sv1_type indicates that the entry is for a domain, this
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * specifies the name of server running the domain master browser;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * otherwise, it specifies a comment describing the server. The comment
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * can be a null string or the pointer may be a null pointer.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * In case there are multiple SERVER_INFO_1 data structures to
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * return, the server may put all these fixed length structures in
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * the return buffer, leave some space and then put all the variable
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * length data (the actual value of the sv1_comment strings) at the
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * end of the buffer.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * There is no auxiliary data to receive.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amwsmb_trans_net_server_enum2(struct smb_request *sr, struct smb_xa *xa)
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown if (smb_strcasecmp(si->skc_nbdomain, (char *)domain, 0) != 0) {
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_param_mb, "wwww", 0, 0, 0, 0);
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_param_mb, "wwww", 0, 0, 0, 0);
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_data_mb, "16c", hostname);
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&str_mb, "s", si->skc_system_comment);
3db3f65c6274eb042354801a308c8e9bc4994553amw (void) smb_mbc_encodef(&xa->rep_data_mb, "m", str_mb.chain);
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown for (i = 0; i < sizeof (mailslots)/sizeof (mailslots[0]); ++i)
bbf6f00c25b6a2bed23c35eac6d62998ecdb338cJordan Brown if (smb_strcasecmp(mailslot, mailslots[i], 0) == 0)
68b2bbf26c7040fea4281dcb58b81e7627e46f34Gordon Ross * smb_trans_nmpipe
68b2bbf26c7040fea4281dcb58b81e7627e46f34Gordon Ross * This is used for RPC bind and request transactions.
68b2bbf26c7040fea4281dcb58b81e7627e46f34Gordon Ross * If the data available from the pipe is larger than the maximum
68b2bbf26c7040fea4281dcb58b81e7627e46f34Gordon Ross * data size requested by the client, return as much as requested.
68b2bbf26c7040fea4281dcb58b81e7627e46f34Gordon Ross * The residual data remains in the pipe until the client comes back
68b2bbf26c7040fea4281dcb58b81e7627e46f34Gordon Ross * with a read request or closes the pipe.
68b2bbf26c7040fea4281dcb58b81e7627e46f34Gordon Ross * When we read less than what's available, we MUST return the
68b2bbf26c7040fea4281dcb58b81e7627e46f34Gordon Ross * status NT_STATUS_BUFFER_OVERFLOW (or ERRDOS/ERROR_MORE_DATA)
68b2bbf26c7040fea4281dcb58b81e7627e46f34Gordon Rosssmb_trans_nmpipe(smb_request_t *sr, smb_xa_t *xa)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * A little confusing perhaps, but the fsctl "input" is what we
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * write to the pipe (from the transaction "send" data), and the
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * fsctl "output" is what we read from the pipe (and becomes the
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross * transaction receive data).
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross fsctl.InputCount = xa->smb_tdscnt; /* write count */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross fsctl.OutputCount = 0; /* minimum to read from the pipe */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross fsctl.MaxOutputResp = xa->smb_mdrcnt; /* max to read */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross fsctl.in_mbc = &xa->req_data_mb; /* write from here */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross fsctl.out_mbc = &xa->rep_data_mb; /* read into here */
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross if (NT_SC_SEVERITY(status) == NT_STATUS_SEVERITY_ERROR)
a90cf9f29973990687fa61de9f1f6ea22e924e40Gordon Ross /* Warnings like NT_STATUS_BUFFER_OVERFLOW are OK */
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statessmb_trans_dispatch(smb_request_t *sr, smb_xa_t *xa)
3db3f65c6274eb042354801a308c8e9bc4994553amw if ((rc = smb_mbc_decodef(&xa->req_param_mb, "%wss", sr,
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw switch (rc) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* neato, blast it over there */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw n_setup = (n_setup + 1) / 2; /* Convert to setup words */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw data_pad = (param_off + n_param) & 1; /* Pad to short */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* Param off from hdr start */
3db3f65c6274eb042354801a308c8e9bc4994553amw "bww2.wwwwwwb.Cw#.C#.C",
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, /* Param displacement */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, /* Data displacement */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, 0, 0, /* dscnt dsoff dsdisp */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, /* suwcnt */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0); /* converter word? */
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United Statessmb_trans2_dispatch(smb_request_t *sr, smb_xa_t *xa)
3db3f65c6274eb042354801a308c8e9bc4994553amw if (smb_mbc_decodef(&xa->req_setup_mb, "w", &opcode) != 0)
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Save this for /proc to read later.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* for now, only respond to the */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Should have enough room to send the response
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * data back to client.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (n_data == 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Should have enough room to send the response
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * data back to client.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (n_data == 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Should have enough room to send the response
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * data back to client.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (n_data == 0) {
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States case TRANS2_SET_FS_INFORMATION:
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States rc = smb_com_trans2_set_fs_information(sr, xa);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States break;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Should have enough room to send the response
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * data back to client.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (n_data == 0) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Should have enough room to send the response
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * data back to client.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (n_data == 0) {
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States case TRANS2_GET_DFS_REFERRAL:
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States rc = smb_com_trans2_get_dfs_referral(sr, xa);
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States break;
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States
2c2961f8403049d948b9f3e6c35d6488b6b7e1aajose borrego (void) smb_mbc_encodef(&xa->rep_param_mb, "w", 0);
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw switch (rc) {
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* neato, blast it over there */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw n_setup = (n_setup + 1) / 2; /* Conver to setup words */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * Including the nt_unknown_secret value persuades netmon to
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * display the correct data format for QueryPathInfo and
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * QueryFileInfo.
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw data_pad = (param_off + n_param) & 1; /* Pad to short */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw /* Param off from hdr start */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, /* Param displacement */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw n_data /* + data_pad */, /* Total Data Bytes this buffer */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, /* Data displacement */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, 0, 0, /* dscnt dsoff dsdisp */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0, /* suwcnt */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw 0); /* converter word? */
7f3ef643e446c82e27a9386991b140b128baf22cGordon Rossstatic uint32_t smb_xa_max_param_count = 32 * 1024;
7f3ef643e446c82e27a9386991b140b128baf22cGordon Rossstatic uint32_t smb_xa_max_data_count = 64 * 1024;
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * Sanity check what the client says it will send.
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * Caller handles NULL return as ERRnoroom.
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (total_parameter_count > smb_xa_max_param_count)
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * Limit what the client asks us to allocate for
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * returned setup, params, data.
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross if (max_parameter_count > smb_xa_max_param_count)
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross /* request parts */
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross xa->req_setup_mb.max_bytes = setup_word_count * 2;
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross xa->req_param_mb.max_bytes = total_parameter_count;
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross /* reply parts */
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross xa->rep_setup_mb.max_bytes = max_setup_count * 2;
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross xa->rep_param_mb.max_bytes = max_parameter_count;
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * The new xa structure is checked against the current list to see
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw * if it exists already.
9fb67ea305c66b6a297583b9b0db6796b0dfe497afshin salek ardakani - Sun Microsystems - Irvine United States smb_mem_free(xa->xa_pipe_name);
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross /* request parts */
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross /* reply parts */
da6c28aaf62fa55f0fdb8004aa40f88f23bf53f0amw if (xa->xa_flags & (SMB_XA_FLAG_COMPLETE | SMB_XA_FLAG_CLOSE)) {
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * During trans & trans-secondary processing,
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * we copied the request data into these.
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * Now we want to parse them, so we need to
7f3ef643e446c82e27a9386991b140b128baf22cGordon Ross * move the "finger" back to the beginning.